VLOOKUP with IF OR returning N/A or BLANK

UniqueUsername

New Member
Joined
Dec 9, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I have a table that due to sizing issues, I've split in 2 and placed side by side.

To simplify things, I'll use a Fruit/Price example. Column A&C are Fruit, Column B&D are the price of the fruit in the previous column.

I need to complete a VLOOKUP on the fruit to return the price. If the fruit is listed without a price or if the fruit isn't listed at all, I have additional calculations to complete.

My problem is trying to create a formula that checks whether the VLOOKUP produces an error or returns a blank.

I've tried
=IF(OR(ISNA(VLOOKUP("ORANGE", A2:B4,2,FALSE)),VLOOKUP("ORANGE",A2:B4,2,FALSE)),"TRUE","FALSE")

While the first part of the OR statement is true, ORANGE isn't found in the vlookup, the formula returns #N/A because the second part of the formula fails. How do I get the OR to stop calculating at the first "TRUE" statement?

Ultimately, the idea is to do the same search on C:D and complete other calculations if that fails as well.

Any ideas would be appreciated!
 

Attachments

  • excel.PNG
    excel.PNG
    8.3 KB · Views: 26

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi & welcome to MrExcel.
How about
Excel Formula:
=LET(x,XLOOKUP("orange",A2:A4,B2:B4,XLOOKUP("orange",C2:C4,D2:D4)),IF(ISNA(x),"not found",IF(x="","no data",x)))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
Sadly, it works beautifully in Excel, but when I does not work in Google Sheets, which is my end goal and should have started in that direction.

Any ideas without the LET function?
 
Upvote 0
How about
Excel Formula:
=IF(ISNA(XLOOKUP("orange",A2:A4,B2:B4,XLOOKUP("orange",C2:C4,D2:D4))),"not found",IF(XLOOKUP("orange",A2:A4,B2:B4,XLOOKUP("orange",C2:C4,D2:D4))="","no data",XLOOKUP("orange",A2:A4,B2:B4,XLOOKUP("orange",C2:C4,D2:D4))))

It's always best to develop in the system you want to use. There are a lot of differences between Xl & Sheets.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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