Excle 中数据查找匹配

REF:

Excel Vlookup Index Match - Excel Tips - MrExcel Publishing

INDEX Function

INDEX Function

First, there is the INDEX() function. This is a horribly named function. When someone says "index", it does not conjure up anything in my mind that is similar to what this function does. Index requires three arguments.

=INDEX(data range, row number, column number)

In English, Excel goes to the data range and returns you the value in the intersection of the (row number)th row and the (column number)th column. Hey, think about it - this is pretty simple, right? =INDEX($A$2:$C$6,4,2) will give you the value in B5.

Applying INDEX() to our problem, you can figure that to return the employee number from the range, you would use this: =INDEX($A$2:$A$6,?,1). Actually, this piece of it seems so trivial that it seems useless. But, when you replace the question mark with a MATCH() function, you have the solution.

MATCH Function

MATCH Function

Here is the syntax:

=MATCH(Value, Single-column data range, FALSE)

It tells Excel, "Search the data range and tell me the relative row number where you find a match for (data). So, to find which row has the employee in A10, you would use =MATCH(A10,$B$2:$B$6,FALSE). Yes, this is more complex than Index, but it should be right up the alley of VLOOKUP pros. If A10 contains "Miller, Bob" then this MATCH will return that he is in the 3rd row of the range B2:B6.

INDEX and MATCH Functions Together

INDEX and MATCH Functions Together

There it is - the MATCH() function tells the Index function which row to look in - you are done. Take the Index function, replace our question mark with the MATCH function, and you can now do the equivalent of VLOOKUPs when the key field is not in the left column. Here is the function to use:

=INDEX($A$2:$A$6,MATCH(A10,$B$2:$B$6,FALSE),1)

The sticky note on my wall actually shows it as two lines. First I wrote out the explanation for MATCH(). Below that I wrote the explanation for INDEX(). I then drew a funnel shape between the two to indicate that the MATCH() function drops in to the 2nd argument of the INDEX() function.

Result

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值