简体   繁体   中英

Excels INDEX with MATCH for multiple criteria

I am experimenting with excel's functions. Say I have the following example values
Column
A1 - "Andrew"
B1 - "Morton"
B2 - "Andrew"
A2 - "Morton"
A3 - "2"

Why is my formula not printing the output 2?

=INDEX($A$3:$A$3,
MATCH(A1, ($A$1=$B$2:$B$2) * ($B$1 = $A$2:$A$2), 0))

The following prints the correct output 2 with single criteria.

=INDEX($A$3:$A$3,
MATCH(A1,$B$2:$B$2,0),1)

Thanks in advance.

These type of formulas don't work well with single cell ranges, as per your example.

Lets assume first names in A2:A10 and last names in B2:B10 - if you want to find the row which matches both names and return the corresponding value from C2:C10 you can use this "array formula":

=INDEX($C$2:$C$10,MATCH(1,($A$2:$A$10="Andrew")*($B$2:$B$10="Morton"),0))

confirm with CTRL + SHIFT + ENTER

....or you can add an extra INDEX function to avoid array entry

=INDEX($C$2:$C$10,MATCH(1,INDEX(($A$2:$A$10="Andrew")*($B$2:$B$10="Morton"),0),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