VLOOKUP formula within IF command

Andrewrx

New Member
Joined
Aug 12, 2002
Messages
32
I have the following formula:

=IF(VLOOKUP(B3,BARCODES!C:D,1,FALSE)=B3,"ISSUED!!","Free")

which checks down a list of barcodes to confirm whether each number has been issued or not.
This works, but when the 'value-is-false' I get a #N/A value rather than the "free" value as indicated in my formula.

Is there a way to get the correct value?
 
=IF(VLOOKUP(B3,BARCODES!C:D,1,FALSE)=B3,"ISSUED!!","Free")


try

if(or(iserror(vlookup(b3,barcodes!C:D,1,false),vlookup(b3,barcodes!c:d,1,false)<>b3),"Free","Issued!!")
 
Upvote 0
This formula tells me I have entered too many arguments!
and highlights B3 after the <> signs?

Is this formula checking the result is greater or less than the search field?
 
Upvote 0
This formula tells me I have entered too many arguments!
and highlights B3 after the <> signs?

Is this formula checking the result is greater or less than the search field?
 
Upvote 0
On 2002-09-19 04:05, Andrewrx wrote:
I have the following formula:

=IF(VLOOKUP(B3,BARCODES!C:D,1,FALSE)=B3,"ISSUED!!","Free")

which checks down a list of barcodes to confirm whether each number has been issued or not.
This works, but when the 'value-is-false' I get a #N/A value rather than the "free" value as indicated in my formula.

Is there a way to get the correct value?

=IF(ISNUMBER(MATCH(B3,C:C,0)),"ISSUED!!","Free")
 
Upvote 0
Andrew - this is a typo - the formula should read...

IF(OR(ISERROR(VLOOKUP(b3,barcodes!C:D,1,false)),vlookup(b3,barcodes!c:d,1,false)<>b3),"Free","Issued!!")

This should give you the right result...it's checking for errors and non matches re: b3 first, if it doesn't find an error or non-match then it must be a match...just working the opposite way to your previous code.

Let me know if this works...if you're still getting an error send me the workbook.
 
Upvote 0
On 2002-09-19 04:53, lasw10 wrote:
Andrew - this is a typo - the formula should read...

IF(OR(ISERROR(VLOOKUP(b3,barcodes!C:D,1,false)),vlookup(b3,barcodes!c:d,1,false)<>b3),"Free","Issued!!")

This should give you the right result...it's checking for errors and non matches re: b3 first, if it doesn't find an error or non-match then it must be a match...just working the opposite way to your previous code.

Let me know if this works...if you're still getting an error send me the workbook.

That's a lot of double computing. Does what you suggest compute anything different from what I proposed?
 
Upvote 0
Unlikely - with over 4000 posts I bow to your code...I am not familiar with the your code that's all...

The one thing that's always true with Excel VB coders is that everyone has their favoured approach to coding, problem solving etc... Always best to ensure that you're using the code that your most comfortable with...just in case something goes wrong.

Will look at your code and see if I can get to grips with it...

Thanks
Luke
 
Upvote 0
Many thanks for your info,

I have used the formula from Aladin Akyurek, which seems to work fine.

Appriciate all your help

regards
Andrew
 
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