How to vlookup value with multiple criteria in Excel?
In Excel, we can quickly vlookup the corresponding data in a list based on a specific criterion that you set by using the vlookup function. But, if you need to vlookup the relative value based on multiple criteria, how could you deal with it?
Supposing I have the following data range which I want to use two criteria to return the relative value, for example, I know the product and staff name need to return their corresponding total price value in the same row:
LOOKUP function may help you solve this problem, please type this formula into a specified cell: =LOOKUP(2,1/(A2:A10=G2)/(B2:B10=G3),(D2:D10)), and press Enter key to get the correct result you would like, see screenshot:
With the SUMPRODUCT function, you can also solve this task.
Please enter this formula: =SUMPRODUCT((A2:A10=G2)*(B2:B10=G3)*(D2:D10)) into a blank cell you specified, and tap the Enter key to return the result, see screenshot:
In Excel, the mixed INDEXT and MATCH function is powerful for us to vlookup values based on one or more criteria, to know this formula, do as follows:
Type this formula =INDEX(D2:D10,MATCH(1,(A2:A10=G2)*(B2:B10=G3),0)) into a blank cell, and press Ctrl + Shift + Enter keys together, then you will get the relative value as you want, see screenshot:
1. In the above formulas:
- A2:A10=G2: which means to search the criteria of G2 in range A2:A10;
- B2:B10=G3: means to search the criteria of G3 in range B2:B10;
- D2:D10: refers to the range which you want to return the corresponding value.
2. All of the above examples show you how to use two criteria for lookups. If you have more than two criteria, you just need to add them to the formulas, such as :
You are guest
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 10 months agoThe lookup will not work if there is a formula in the cell, what is the remedy ??
- To post as a guest, your comment is unpublished.· 1 years agoyou are too genius, you solve my issue.
- To post as a guest, your comment is unpublished.· 2 years agoThis is an elegant formula, also easily expansible to more criteria. The one donwside of INDEX+MATCH formulas is that it's really slow in larger datasets.
- To post as a guest, your comment is unpublished.· 1 years agoIndex match should be faster in my personal opinion. It has been tested as well by many. If uses index match in an array, definitely it will be slower since it will become like a volatile formula. The above formula uses index match in array for multiple criteria condition which actually can be change to non-array type as well ;)
- To post as a guest, your comment is unpublished.· 3 years agoThanks for this tutorial; :-)
I have a question. What formula should I used? I have a series of data in a row like A1:M1, I'd like a result that if there is/are data that is/are < or > in specific number, it will result to "Disqualified" if it's true or " " (space) if false.
- To post as a guest, your comment is unpublished.· 4 years agoHello, Thanks for this tutorial, it's very helpful. The following formula works great. =LOOKUP(2,1/(B:B=H97)/(I:I=H98),E:E). I have a simple question.
What I want is, the cell should get the value if (H98 = open) If "open" is not there in (I:I) match (H99 = Under observation) from (I:I) and get the value, If possible get the row.
I want to keep the formula as lite as possible. As I will be copying this formula in lots of cells.
Also kindly suggest which of the above formula (LOOKUP/SUMPRODUCT/INDEX) is less processor intensive.
- To post as a guest, your comment is unpublished.· 1 years ago=LOOKUP(2,1/(A2:A10=G2)/(B2:B10=G3),(D2:D10)) what does the 2 mean?