简体   繁体   中英

Index Match Match with multiple criteria

I am trying to set up an IndexMatchMatch formula with two column and one row criteria: two column criteria for country code and variable name, and a row criteria for the year.

The data sheet (DATA_WDI) that contains the information has the variable name and country name in two separate columns and the years spread out over the remaining columns (so a wide-format)

Code    Series      1999    2000    2001

AFG     GDPpc       #N/A    #N/A    #N/A

AFG     GDPpcG      #N/A    #N/A    #N/A

AFG     Poverty     #N/A    #N/A    #N/A

The formula I have tried but unfortunately doesn't work is:

{=INDEX(DATA_WDI!$A$1:$X$2377,MATCH(1,(DATA_WDI!$A$1:$X$2377=Example!C$15)*(DATA_WDI!$A$1:$X$2377=Example!$A$17),0),MATCH(Example!$B17,DATA_WDI!$A$1:$X$1,0))}

Or without the excel reference:

{=INDEX(Data_Range,MATCH(1,(Data_column1=variable1)*(Data_column2=variable2),0),MATCH(Variable3,Data_rows,0))}

Any suggestions how this could be done instead?

If there are only unique pairs then you can use

=SUMPRODUCT(($A$1:$a$2377="searchterm1")*($b$1:$b$2377="searchterm2")*(ROW(a1:a2377))

to determine the row you need. If pairs can occur multiple times, then you need something with LARGE . Let us know if this is the case

Thanks a lot Scott and OverflowStacker!

In the end, this worked for me:

{=INDEX(DATA_WDI!$A$1:$X$2377,MATCH(Example!C$15&Example!$A$16,DATA_WDI!$B$1:$B$2377&DATA_WDI!$C$1:$C$2377,0),MATCH(Example!$B16,DATA_WDI!$A$1:$X$1,0))}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM