Vlookup with mulitiple outputs

Caracarn

New Member
Joined
Jan 18, 2022
Messages
5
Office Version
  1. 2021
  2. 2011
  3. 2010
Platform
  1. Windows
I'm trying to use a Vlookup function, but I want it to have multiple possible outputs. All of the other help I've seen seems to just want to outputs, an error, and a correct. I'm trying for three different outputs. I've tried searching for help multiple different ways, but I can't seem to find something that is exactly what I'm looking for.

If the input is blank I want the output to be blank.
If the input is an item in my list I want it to output the ingredients for that item.
If the input is not an item in my list I want it to output "Not in List".


This is what I've tried so far:
Excel Formula:
=IFERROR(IF(VLOOKUP(B2,Recipes!A:B,2,false)="","",VLOOKUP(B2,Recipes!A:B,2,false)),"Not in List")

If I type a correct input it gives me a correct output, If I type an incorrect input it gives me the "Not in List" error, but If I leave my input cell blank it doesn't leave the output cell blank. It gives me the "Not in List" error again.

Any help would be much appreciated!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
your problem is, without the check if(vlook(..)="","" you receive a 0 as result.
If you hide that zero with conditional formatting or by a setting in your workbook for each worksheet, you don't need this extra if
 
Upvote 0
Hi & welcome to MrExcel.
How about
Excel Formula:
=IF(B2="","",IFERROR(IF(VLOOKUP(B2,Recipes!A:B,2,FALSE)="","",VLOOKUP(B2,Recipes!A:B,2,FALSE)),"Not in List"))
 
Upvote 0
Solution
your problem is, without the check if(vlook(..)="","" you receive a 0 as result.
I tried removing the IF(Vlookup(...)="","" which left me this
Excel Formula:
=IFERROR(VLOOKUP(B2,Recipes!A:B,2,false)),"Not in List")
This leaves me with an error message though.
 
Upvote 0
Hi & welcome to MrExcel.
How about
Excel Formula:
=IF(B2="","",IFERROR(IF(VLOOKUP(B2,Recipes!A:B,2,FALSE)="","",VLOOKUP(B2,Recipes!A:B,2,FALSE)),"Not in List"))
Well I'll be. That works! Thanks for the help! Do I still need to have the additional
Excel Formula:
VLOOKUP(B2,Recipes!A:B,2,FALSE)="",""
? Since the B2="","" is outputting a blank if the input is a blank.
 
Upvote 0
Try

Excel Formula:
=IFERROR(IF(B2="","",IF(VLOOKUP(B2,Recipes!A:B,2,0)="","",VLOOKUP(B2,Recipes!A:B,2,0))),"Not in List")
 
Upvote 0
Do I still need to have the additional
Excel Formula:
VLOOKUP(B2,Recipes!A:B,2,FALSE)="",""
? Since the B2="","" is outputting a blank if the input is a blank.
Yes you still need that
 
Upvote 0
your problem is, without the check if(vlook(..)="","" you receive a 0 as result.
If you hide that zero with conditional formatting or by a setting in your workbook for each worksheet, you don't need this extra if
I just realized that I read your first reply completely in correctly. I completely overlooked the 'check if' statement. I apologize. I just saw "without vlook=""" So i deleted it, I realize now what your first comment was telling me. Sorry for the trouble.
 
Upvote 0
? Since the B2="","" is outputting a blank if the input is a blank.
Yes you do still need that incase col B on Recipes is blank.
However if this only needs to work in xl2021, it can be simplified.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
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