作者:jajajaja幸福_348 | 来源:互联网 | 2023-10-11 13:19
IamtryingtoachieveabasiclookupusingINDEXandMATCH.Mylayoutis:我正在尝试使用索引和匹配实现基本查找。我的规划是:
I am trying to achieve a basic lookup using INDEX and MATCH. My layout is:
我正在尝试使用索引和匹配实现基本查找。我的规划是:
Sheet 1
NAME | SITE | DATE
Sheet 2
NAME | SITE | DATE
I want the 'SITE' column in Sheet 1 to automatically populate with the SITE from Sheet 2 where NAME and DATE match.
我希望表1中的“SITE”列自动填充表2中的站点,其中名称和日期匹配。
What I've Tried
我已经试过
=INDEX('Sheet2'!B:B,MATCH(A1,'Sheet2'!A:A,0))
This will successfully match NAME, but how can I incorporate an additional MATCH into the formula to match on both NAME and DATE?
这将成功地匹配名称,但是如何在公式中添加匹配的名称和日期?
3 个解决方案
11
You can use an "array formula" like this
您可以使用这样的“数组公式”
=INDEX('Sheet2'!B:B,MATCH(1,(A1='Sheet2'!A:A)*(C1='Sheet2'!C:C),0))
=指数(“Sheet2”! B:B,匹配(1,(A1 = ' Sheet2 ! A:A)*(C1 =“Sheet2”! C:C),0))
CTRL+SHIFT+ENTER
CTRL + SHIFT + ENTER
....or you can add another INDEX function so that it doesn't need to be "array entered", i.e.
....或者您可以添加另一个索引函数,这样它就不需要“输入数组”,例如。
=INDEX('Sheet2'!B:B,MATCH(1,INDEX((A1='Sheet2'!A:A)*(C1='Sheet2'!C:C),0),0))
=指数(“Sheet2”! B:B,匹配(1、索引((A1 = ' Sheet2 ! A:A)*(C1 =“Sheet2”! C:C),0),0))
or another way is to use LOOKUP like this
另一种方法是像这样查找
=LOOKUP(2,1/(A1='Sheet2'!A:A)/(C1='Sheet2'!C:C),'Sheet2'!B:B)
=查找(2,1 /(A1 = ' Sheet2 ! A:A)/(C1 =“Sheet2”! C:C),“Sheet2”! B:B)
That latter method would give you the last match if there is more than one......
如果有多个匹配项,后一种方法将给出最后一个匹配项