在Excel中区分大小写的查询

In a lookup table, how can you get Excel to find the item that's the exact match, including the upper and lower case?

在查找表中,如何获取Excel以查找完全匹配的项(包括大写和小写)?

For example, in this table, row 4 is M7 and row 5 is m7. There's a different value for each of these in column B. If I do a lookup for m7, I want the result to be 5, not 4.

例如,在此表中,第4行是M7 ,第5行是m7 。 B列中的每个都有一个不同的值。如果我对m7进行查找,我希望结果为5,而不是4。

LUCase01

VLOOKUP不区分大小写 (VLOOKUP Is Not Case Sensitive)

You could try a VLOOKUP formula, to find the value for m7, but it's not case sensitive. In the following screenshot you can see a VLOOKUP formula in the formula bar, and the result of 4 in cell E1.

您可以尝试使用VLOOKUP公式来查找m7的值,但这并不区分大小写。 在以下屏幕截图中,您可以在编辑栏中看到VLOOKUP公式,并在单元格E1中看到4的结果。

LUCase02

On the Microsoft website, there's an article that explains how to perform a case sensitive lookup. One sample formula uses IF and EXACT with VLOOKUP to check the case.

在Microsoft网站上,有一篇文章介绍了如何执行区分大小写的查找 。 一个示例公式使用IF和EXACT与VLOOKUP来检查情况。

In our sample sheet, the suggested formula is:

在我们的样本表中,建议的公式为:

=IF(EXACT(D1,VLOOKUP(D1,A1:B6,1,FALSE))=TRUE, VLOOKUP(D1,A1:B6,2,FALSE), "No exact match")

= IF(EXACT(D1,VLOOKUP(D1,A1:B6,1,FALSE))= TRUE,VLOOKUP(D1,A1:B6,2,FALSE),“无完全匹配”)

However, this doesn't work in our sample table, because it stops at the M7, and that's not an exact match for the lookup value m7.

但是,这在我们的示例表中不起作用,因为它在M7处停止,并且与查找值m7并不完全匹配。

区分大小写的索引匹配 (Case Sensitive INDEX MATCH)

The Microsoft article has other sample formulas, including an INDEX MATCH, but they all have the same problem, stopping at the M7 above the m7 value.

Microsoft文章还有其他示例公式,包括INDEX MATCH,但是它们都有相同的问题,停在m7值以上的M7。

Fortunately, a search in Google Groups led me to an array formula posted by my old friend, former Excel MVP Peo Sjoblom. For our table, Peo's formula would be:

幸运的是,通过Google网上论坛的搜索,我找到了我的老朋友,前Excel MVP Peo Sjoblom发布的数组公式。 对于我们的表,Peo的公式为:

=INDEX(B1:B6,MATCH(1,--EXACT(A1:A6,D1),0))

This is an array formula, so type the formula then press Ctrl+Shift+Enter. Curly brackets will automatically appear at the start and end of the formula.

这是一个数组公式 ,因此键入公式,然后按Ctrl + Shift + Enter 。 括号将自动出现在公式的开头和结尾。

In the screenshot below you can see the formula, and the correct result of 5, in cell E1. The formula finds an exact, case sensitive match for the lookup value.

在下面的屏幕截图中,您可以在单元格E1中看到该公式以及正确的结果5。 该公式为查找值找到一个精确的,区分大小写的匹配项。

LUCase04

更多Excel函数示例 (More Excel Function Examples)

On the Contextures website you can find more examples of the Excel INDEX function and the Excel MATCH function. __________________

在Contextures网站上,您可以找到Excel INDEX函数Excel MATCH函数的更多示例。 __________________

翻译自: https://contexturesblog.com/archives/2009/10/16/case-sensitive-lookup-in-excel/

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值