Excel uses VLOOKUP+IF to achieve multi-column matching search

The vlookup function in excel is an exact match search, but this function is limited to the exact match of a single column. If the requirement is to match the conditions of multiple columns, how to achieve it through the vlookup function?
Idea: Use the if function to combine multiple columns into one column and then use the vlookup function for precise matching

The specific formula is: =VLOOKUP($F2&$G2,IF({1,0},$A:$A&$B:$B,$C:$C),2,0)
This is an array function. After inputting, you must press the key combination to run:
the outermost layer in the red box of shift+ctrl+enter is automatically generated by the above key combination. There is no need to manually enter the
Insert picture description here
function to disassemble: When target A=condition A and target B=condition B, let the input box=value C
1.$F2&$G2——target A&target B
2.$A:$A——condition A column
3.$B: $B——condition B column
4.$C:$C——value column C
5 =VLOOKUP($F2&$G2,IF({1,0},$A:$A&$B:$B,$C:$C),2,0).——In "IF({1,0}", according to two conditions, return two values ​​of IF respectively, and at the same time Combine the two results into an array. For example: =IF({1,0},A1:A2,B1:B2), the return is A1:B2. (Or it is composed of {A1,B1;A2,B2} Array)
6. The effect of replacing IF({1,0} with CHOOSE({1,2} ) here is the same

Match search through three columns
Insert picture description here

Guess you like

Origin blog.csdn.net/lz6363/article/details/109279497