if, iferror in vlooup

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi

Why this formula is working

=IF(ISERROR(VLOOKUP(A2,B:B,1,FALSE)),B2,"")

I tried to use Iserror(function) without second argument and excel did not accept that but the above function works! can you please break it down. I tried to do it myself and never get it work! thank you.

Source
https://www.smartsheet.com/advanced-vlookup-multiple-criteria
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
ISERROR(VLOOKUP(A2,B:B,1,FALSE))
does NOT have an error condition
so you will return a TRUE if there is an Error and a FALSE if it finds the lookup

that is then the test part of an IF function

=IF(TEST,B2,"")

which means when it returns a TRUE - Lookup NOT found , it will execute the TRUE part of the IF() which is B2
when FALSE will return ""

hope that clarifies for you

The vlookup does not return anything as a value into the formula - just TRUE or FALSE
 
Last edited:
Upvote 0
=ISERROR(VLOOKUP(A2,B:B,1,FALSE)

is perfectly legitimate. It will return FALSE if VLOOKUP succeeds, otherwise TRUE.

Thus:

=IF(ISERROR(VLOOKUP(A2,B:B,1,FALSE)),B2,"")

will return B2 if VLOOKUP fails.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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