How to lookup text with multi criteria (in Excel 2019)

Sochen

Board Regular
Joined
Dec 6, 2022
Messages
66
Office Version
  1. 2021
Platform
  1. Windows
Hi All,

How to lookup "location" in yellow highlight below with 3 criteria which include "Week", "Department", "Categories":

Book2
ABCDEFGHIJKL
1
2
3Week1234Criteria 1Criteria 2Criteria 3
4Smart PhoneWeekLocationDepartmentCategories
5Table 1iPhoneVivoLGSamsung1Table 1Smart PhoneiPhone
6Table 2NokiaiPhoneSamsungiPhone1Table 1Smart PhoneiPhone
7Table 3SamsungSamsungiPhoneNokia1Table 3Smart PhoneSamsung
8Laptop1Table 2Smart PhoneNokia
9Table 1DellHPASUSDell2Table 2Smart PhoneiPhone
10Table 2HPDellHPHP2Table 1Smart PhoneVivo
11Table 3ACERACERDellACER2Table 3Smart PhoneSamsung
122Table 1Smart PhoneVivo
133Table 1Smart PhoneLG
143Table 3Smart PhoneiPhone
154Table 2Smart PhoneiPhone
164Table 2Smart PhoneiPhone
174Table 1Smart PhoneSamsung
184Table 2Smart PhoneiPhone
19
Sheet1
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
In your sample data there is no reference to laptops. How would that be determined?
Also, in your sample, Table 3 in Week 4: there is no entry for Table 3, so how do you determine it's "Nokia"?
 
Upvote 0
BTW: your post says 2019 but your profile says 2021...which is it? Makes a big difference.
 
Upvote 0
In your sample data there is no reference to laptops. How would that be determined?
Also, in your sample, Table 3 in Week 4: there is no entry for Table 3, so how do you determine it's "Nokia"?
Hello Sir,

Thank you for your response.
The left table which is the plan that set up in advance by weekly. And the right table of each week performance, which I also want to know the "Location" of each department, categories by week.

I can add on the result of department for laptop as below.

And I put excel 2019 because I want to formula also can be worked in office 2019 because some of the formulas in office 21 are not available in office 19.

Thank you!

Test 18.xlsx
ABCDEFGHIJKL
1
2
3Week1234Criteria 1Criteria 2Criteria 3
4Smart PhoneWeekLocationDepartmentCategories
5Table 1iPhoneVivoLGSamsung1Table 1Smart PhoneiPhone
6Table 2NokiaiPhoneSamsungiPhone1Table 1Smart PhoneiPhone
7Table 3SamsungSamsungiPhoneNokia1Table 3Smart PhoneSamsung
8Laptop1Table 2Smart PhoneNokia
9Table 1DellHPASUSDell2Table 2Smart PhoneiPhone
10Table 2HPDellHPHP2Table 1Smart PhoneVivo
11Table 3ACERACERDellACER2Table 3Smart PhoneSamsung
122Table 1Smart PhoneVivo
133Table 1Smart PhoneLG
143Table 3Smart PhoneiPhone
154Table 2Smart PhoneiPhone
164Table 2Smart PhoneiPhone
174Table 1Smart PhoneSamsung
184Table 2Smart PhoneiPhone
191Table 2LaptopHP
201Table 1LaptopDell
211Table 3LaptopACER
221Table 1LaptopDell
232Table 1LaptopHP
242Table 1LaptopHP
252Table 3LaptopACER
262Table 2LaptopDell
27
Sheet1
 
Upvote 0
Your right table is still incomplete compared to the left table results. But, maybe this will work.
You'll have to change the ROW reference based on how any rows are in the right table or use a formula to count them.

My first suggestion:

021623 Misc.xlsx
MNOPQ
9Smart Phone
10Table 1iPhoneVivoLGSamsung
11Table 2NokiaiPhone iPhone
12Table 3SamsungSamsungiPhoneNokia
13Laptop
14Table 1DellHP  
15Table 2HP   
16Table 3Acer   
Sheet17
Cell Formulas
RangeFormula
N10:Q12N10=IF(0<>SUM(($B5 =$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$4=$J$5:$J$24)),INDEX($K$5:$K$24,MAX(($B5=$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$4=$J$5:$J$24)*ROW($1:$20))),"")
N14:Q16N14=IF(0<>SUM(($B9 =$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$8=$J$5:$J$24)),INDEX($K$5:$K$24,MAX(($B9=$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$8=$J$5:$J$24)*ROW($1:$20))),"")
 
Upvote 0
Your right table is still incomplete compared to the left table results. But, maybe this will work.
You'll have to change the ROW reference based on how any rows are in the right table or use a formula to count them.

My first suggestion:

021623 Misc.xlsx
MNOPQ
9Smart Phone
10Table 1iPhoneVivoLGSamsung
11Table 2NokiaiPhone iPhone
12Table 3SamsungSamsungiPhoneNokia
13Laptop
14Table 1DellHP  
15Table 2HP   
16Table 3Acer   
Sheet17
Cell Formulas
RangeFormula
N10:Q12N10=IF(0<>SUM(($B5 =$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$4=$J$5:$J$24)),INDEX($K$5:$K$24,MAX(($B5=$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$4=$J$5:$J$24)*ROW($1:$20))),"")
N14:Q16N14=IF(0<>SUM(($B9 =$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$8=$J$5:$J$24)),INDEX($K$5:$K$24,MAX(($B9=$I$5:$I$24)*(C$3=$H$5:$H$24)*($B$8=$J$5:$J$24)*ROW($1:$20))),"")
My sincere apologies as I think my explanation is not clear though.
So please find the below explanation in the table below:

Test 18.xlsx
ABCDEFGHIJKL
1This is the table that created in advance by weeklyThis is the table B which need to lookup the location from "Table A".
2Table AWeekWeekWeekWeek
3DepartmentLocation1234Criteria 1Lookup the location?Criteria 2Criteria 3
4Smart PhoneTable 1iPhoneVivoLGSamsungWeekLocationDepartmentCategories
5Smart PhoneTable 2NokiaiPhoneSamsungiPhone1?Smart PhoneiPhone
6Smart PhoneTable 3SamsungSamsungiPhoneNokia1?Smart PhoneiPhone
7LaptopTable 1DellHPASUSDell1?Smart PhoneSamsung
8LaptopTable 2HPDellHPHP1?Smart PhoneNokia
9LaptopTable 3ACERACERDellACER2?Smart PhoneiPhone
102?Smart PhoneVivo
112?Smart PhoneSamsung
122?Smart PhoneVivo
133?Smart PhoneLG
143?Smart PhoneiPhone
154?Smart PhoneiPhone
164?Smart PhoneiPhone
174?Smart PhoneSamsung
184?Smart PhoneiPhone
191?LaptopHP
201?LaptopDell
211?LaptopACER
221?LaptopDell
232?LaptopHP
242?LaptopHP
252?LaptopACER
262?LaptopDell
27
Sheet1 (2)
 
Upvote 0
On the latest layout in post #6 you could use something like the below.
Note: If you now that the item is only ever going to be in one department you could simplify the formula quite a bit.

Book2
ABCDEFGHIJK
1This is the table that created in advance by weeklyThis is the table B which need to lookup the location from "Table A".
2Table AWeekWeekWeekWeek
3DepartmentLocation1234Criteria 1Lookup the location?Criteria 2Criteria 3
4Smart PhoneTable 1iPhoneVivoLGSamsungWeekLocationDepartmentCategories
5Smart PhoneTable 2NokiaiPhoneSamsungiPhone1Table 1Smart PhoneiPhone
6Smart PhoneTable 3SamsungSamsungiPhoneNokia1Table 1Smart PhoneiPhone
7LaptopTable 1DellHPASUSDell1Table 3Smart PhoneSamsung
8LaptopTable 2HPDellHPHP1Table 2Smart PhoneNokia
9LaptopTable 3ACERACERDellACER2Table 2Smart PhoneiPhone
102Table 1Smart PhoneVivo
112Table 3Smart PhoneSamsung
122Table 1Smart PhoneVivo
133Table 1Smart PhoneLG
143Table 3Smart PhoneiPhone
154Table 2Smart PhoneiPhone
164Table 2Smart PhoneiPhone
174Table 1Smart PhoneSamsung
184Table 2Smart PhoneiPhone
191Table 2LaptopHP
201Table 1LaptopDell
211Table 3LaptopACER
221Table 1LaptopDell
232Table 1LaptopHP
242Table 1LaptopHP
252Table 3LaptopACER
262Table 2LaptopDell
Data
Cell Formulas
RangeFormula
I5:I26I5=LOOKUP(2, 1/( ($A$4:$A$9=J5)* (INDEX($A$4:$F$9, 0, MATCH(H5,$A$3:$F$3,0)) = K5 ) ), $B$4:$B$9)
 
Upvote 0
On the latest layout in post #6 you could use something like the below.
Note: If you now that the item is only ever going to be in one department you could simplify the formula quite a bit.

Book2
ABCDEFGHIJK
1This is the table that created in advance by weeklyThis is the table B which need to lookup the location from "Table A".
2Table AWeekWeekWeekWeek
3DepartmentLocation1234Criteria 1Lookup the location?Criteria 2Criteria 3
4Smart PhoneTable 1iPhoneVivoLGSamsungWeekLocationDepartmentCategories
5Smart PhoneTable 2NokiaiPhoneSamsungiPhone1Table 1Smart PhoneiPhone
6Smart PhoneTable 3SamsungSamsungiPhoneNokia1Table 1Smart PhoneiPhone
7LaptopTable 1DellHPASUSDell1Table 3Smart PhoneSamsung
8LaptopTable 2HPDellHPHP1Table 2Smart PhoneNokia
9LaptopTable 3ACERACERDellACER2Table 2Smart PhoneiPhone
102Table 1Smart PhoneVivo
112Table 3Smart PhoneSamsung
122Table 1Smart PhoneVivo
133Table 1Smart PhoneLG
143Table 3Smart PhoneiPhone
154Table 2Smart PhoneiPhone
164Table 2Smart PhoneiPhone
174Table 1Smart PhoneSamsung
184Table 2Smart PhoneiPhone
191Table 2LaptopHP
201Table 1LaptopDell
211Table 3LaptopACER
221Table 1LaptopDell
232Table 1LaptopHP
242Table 1LaptopHP
252Table 3LaptopACER
262Table 2LaptopDell
Data
Cell Formulas
RangeFormula
I5:I26I5=LOOKUP(2, 1/( ($A$4:$A$9=J5)* (INDEX($A$4:$F$9, 0, MATCH(H5,$A$3:$F$3,0)) = K5 ) ), $B$4:$B$9)
Hello Sir,

It works, however, if I change put the duplicate text (iPhone in Week 1 in Yellow color), then the result of the location didn't capture the first match which is "Table 1"but it shows "Table 2 instead. So may I ask how to show result for the first match?

Please check the below table for the yellow color that I put duplicate text.
Thank you!

Test 18.xlsx
ABCDEFGHIJKL
1This is the table that created in advance by weeklyThis is the table B which need to lookup the location from "Table A".
2Table AWeekWeekWeekWeek
3DepartmentLocation1234Criteria 1Lookup the location?Criteria 2Criteria 3
4Smart PhoneTable 1iPhoneVivoLGSamsungWeekLocationDepartmentCategories
5Smart PhoneTable 2iPhoneiPhoneSamsungiPhone1Table 2Smart PhoneiPhoneI want the first match is Table1 as Table one is on the top
6Smart PhoneTable 3NokiaSamsungiPhoneNokia1Table 3Smart PhoneNokia
7LaptopTable 1DellHPASUSDell1Table 3Smart PhoneNokia
8LaptopTable 2HPDellHPHP2Table 2Smart PhoneiPhone
9LaptopTable 3ACERACERDellACER2Table 1Smart PhoneVivo
102Table 3Smart PhoneSamsung
112Table 1Smart PhoneVivo
123Table 1Smart PhoneLG
133Table 3Smart PhoneiPhone
144Table 2Smart PhoneiPhone
154Table 2Smart PhoneiPhone
164Table 1Smart PhoneSamsung
174Table 2Smart PhoneiPhone
181Table 2LaptopHP
191Table 1LaptopDell
201Table 3LaptopACER
211Table 1LaptopDell
222Table 1LaptopHP
232Table 1LaptopHP
242Table 3LaptopACER
252Table 2LaptopDell
26
Sheet1 (2)
Cell Formulas
RangeFormula
I5:I25I5=LOOKUP(2,1/(($A$4:$A$9=J5)*(INDEX($A$4:$F$9,0,MATCH(H5,$A$3:$F$3,0))=K5)),$B$4:$B$9)
 
Upvote 0
It would be so much easier if you were able to use XLookup or Filter.

Try this:
Excel Formula:
=IFERROR(INDEX($B$4:$B$9,AGGREGATE(15,6,(ROW($A$4:$A$9)-ROW($A$4)+1)/((INDEX($A$4:$F$9,0,MATCH(H5,$A$3:$F$3,0))=K5)*($A$4:$A$9=J5)),1)),"")
 
Upvote 0
Solution
It would be so much easier if you were able to use XLookup or Filter.

Try this:
Excel Formula:
=IFERROR(INDEX($B$4:$B$9,AGGREGATE(15,6,(ROW($A$4:$A$9)-ROW($A$4)+1)/((INDEX($A$4:$F$9,0,MATCH(H5,$A$3:$F$3,0))=K5)*($A$4:$A$9=J5)),1)),"")
Hello Sir,

I would highly appreciate it if you could also share about the xlookup.
Thank you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top