IF and XLOOKUP

ekhawaja

Board Regular
Joined
Dec 16, 2018
Messages
75
Office Version
  1. 365
Hello Team,

Looking for a formula to enter in COL C sheet 2 that first checks for a match of col A with col D (sheet 1), if that is true, then it does a lookup of col B in Col H (sheet 2) and returns the corresponding col Z value.

Thanks in advance.

SHEET 1SHEET 2
COL DCOL HCOL ZCOL ACOL BCOL C
223aapple265corange
223bapple223aapple
265corange224f
224epeach220g
223fbanana265corange
 
Hello, if I understand it correctly then maybe something like:

Excel Formula:
=IF(SUM(--(A2=SHEET1!$D$2:$D$6)),XLOOKUP(B2,$H$2:$H$6,$Z$2:$Z$6),"")
 
Upvote 0
Hello, if I understand it correctly then maybe something like:

Excel Formula:
=IF(SUM(--(A2=SHEET1!$D$2:$D$6)),XLOOKUP(B2,$H$2:$H$6,$Z$2:$Z$6),"")
thank you for the reply, the formula seems to be giving me blank values instead of the correct answer. Here is how i have it entered.


=IF(SUM(--(D28467=[Book3.xlsx]Sheet1!$A:$A),XLOOKUP(H28467,[Book3.xlsx]Sheet1!$I:$I,[Book3.xlsx]Sheet1!$AG:$AG)),"")
 
Upvote 0
the formula worked, but I noticed some of the results returned were incorrect. For example , the below red answer should have been orange, not apple. Sorry if this is confusing.

1740429392034.png
 
Upvote 0
Thanks for the feedback. The question is what is decisive for the formula to return "orange"? As there are two values of "a", XLOOKUP will return the first match it will find. For it to return "organge" it would seemigly correspond to the combination of "265" and "a" - but does "265" on SHEET1 have any relation to the values on SHEET2?
 
Upvote 0
Thanks for the feedback. The question is what is decisive for the formula to return "orange"? As there are two values of "a", XLOOKUP will return the first match it will find. For it to return "organge" it would seemigly correspond to the combination of "265" and "a" - but does "265" on SHEET1 have any relation to the values on SHEET2?
the "if statement" should first check if 265 matches, and if it does, it should return the "a" that corresponds to 265, not the "a" that corresponds to 223.
 
Upvote 0

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