Excel Lookup Formula with Two Conditions

2019-08-21 12:31发布

Sorry about the heading but im finding it hard to explain so ill give it my best shot.

Here is my problem I have 3 cells: Lender, product and productID I have a vlookup that fills the lender and product cells just fine However i want a way to bring back the productID back from another worksheet matching with lender and product.

For instance if call1 = newcastle and cell2 = 2 year fixed then cell3 = 422 enter image description here

I tried using a vlookup but doesnt seem to work, Any help on this would be greatly appreciated. Thanks

3条回答
beautiful°
2楼-- · 2019-08-21 12:45

You can use Index and Match to perform a lookup with two criteria. Here is an example of one from http://blog.contextures.com/archives/2012/07/12/check-multiple-criteria-with-excel-index-and-match/

=INDEX($D$2:$D$10,MATCH(1,(A13=$B$2:$B$10)*(B13=$C$2:$C$10),0))

As mentioned on the site, it is an array formula so rather than just pressing enter when you use the formula, you need to hold Ctrl+Shift+Enter.

To break down how the formula is formatted:

=INDEX(a,MATCH(1,(b=c)*(d=e),0))
  • a = The whole range with all the data in it
  • b = The first criteria for the data to be filtered on
  • c = The range in which the first criteria needs to be searched
  • d = The second criteria for the data to be filtered on
  • e = The range in which the second criteria needs to be searched

Make sure that you use $ in the correct places as in the above example.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-21 12:50

Let's say that Newcastle is in A2 and 2 year fixed is in B2. It doesn't matter what worksheet they are on.In another worksheet named Data you have a table with a column of lenders in column X, products in column Y and product IDs in column Z. There are column labels in row 1 so the real data starts in row 2 and there are 2587 rows of data. In the first worksheet's C2 where you want the double lookup for a ProductID that matches Lende and Product try this formula.

=IFERROR(INDEX('Data'!$Z$2:$Z$9999, MIN(INDEX(ROW($1:$9998)+(('Data'!$X$2:$X$9999<>$A2)+('Data'!$Y$2:$Y$9999<>$B2))*1E99,,))), "no match")
查看更多
姐就是有狂的资本
4楼-- · 2019-08-21 12:52

Another alternative to using combination of the MATCH and INDEX functions that some may find more straightforward is to first insert a column on your lookup table and concatenate the cobmination of columns you wish to search by.

=CONCATENATE(B8,C8)

Then you can still use the Vlookup function, but instead of only entering the one column to lookup on, you would combined them in the lookup so that the combination of them looks up to the combination of them on the lookup table.

=VLOOKUP(B3&C3,A9:D10,4,0)

查看更多
登录 后发表回答