Excel - 如何以编程方式将“存储为文本”的数字转换为数字? [英] Excel - How do programmatically convert 'number stored as Text' to Number?

查看:128
本文介绍了Excel - 如何以编程方式将“存储为文本”的数字转换为数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个简单的Excel VBA或公式,可以将Excel中的整个行从存储为文本的数字转换为vlookup原因的实际数字。

I'm looking for a simple Excel VBA or formula that can convert an entire row in Excel from 'number stored as Text' to an actual Number for vlookup reasons.

任何人都可以指向正确的方向?

Can anyone point me in the right direction?

推荐答案

方法



您应该使用 INDEX(MATCH)而不是 VLOOKUP 因为 VLOOKUP 以不可预测的方式表现为导致错误的错误,例如您可能会遇到的错误。

Better Approach

You should use INDEX(MATCH) instead of VLOOKUP because VLOOKUP behaves in an unpredictable manner which causes errors, such as the one you're presumably experiencing.

INDEX ( <return array> , MATCH ( <lookup value> , <lookup array> , 0) )

使用 0 作为 MATCH 的最后一个参数意味着匹配必须是精确的

这里是一些关于 INDEX(MATCH)的更深入的信息 -ing

Using 0 as the last argument to MATCH means the match must be exact
Here is some more in-depth information on INDEX(MATCH)-ing

A dd 0 +0 将值转换为一个数字。

这可以(危险地)扩展为 IFERROR()将非数字文本转换为零:

Add zero +0 to convert a value to a number.
This can be (dangerously) extended with IFERROR() to turn non-numeric text into a zero:

= A2 + 0

= IFERROR(A2 + 0,0)

对于逆向,您可以接吻

如果 0 不用作 MATCH 的最后一个参数,则会发现各种意想不到的比赛..更糟糕的是,即使有完全匹配,也可能会找到不同的价值。

If 0 is not used as the last argument to MATCH, it will find all sorts of unexpected "matches" .. and worse, it may find a different value even when an exact match is present.

做一些额外的工作往往有意义以确定 MATCH 查找列中是否有重复项,否则将返回找到的第一个值(参见示例)。

It often makes sense to do some extra work to determine if there are duplicates in the MATCH lookup column, otherwise the first value found will be returned (see example).

帮助 MATCH 来自这里,特别是第三个参数控件的匹配逻辑。

Help with MATCH comes from here, notably the matching logic the 3rd argument controls.

这篇关于Excel - 如何以编程方式将“存储为文本”的数字转换为数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆