# VLOOKUP formula within IF command

#### Andrewrx

##### New Member
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?

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
=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!!")

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?

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?

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")

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.

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?

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

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

regards
Andrew

Replies
5
Views
132
Replies
9
Views
163
Replies
22
Views
965
Replies
2
Views
191
Replies
1
Views
173

1,207,170
Messages
6,076,912
Members
446,240
Latest member
theprattipati

### 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.

### Which adblocker are you using?

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

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