vlookup - combine iferror and 0 result

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
1,975
Office Version
  1. 365
Platform
  1. Windows
I am having trouble getting the correct syntax for the following situation:

if the vlookup returns either 0 (where the lookup value is in the lookup array but without anything in the required column) or #N/A (where the lookup value is not in the look up arra at all), then give me a blank cell, else do the lookup

i have:

=IF(OR((VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)=0),ISERROR(VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0))),"",VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0))

no matter how i play around with this, I can't get it to return a blank cell when either of my conditions is met. in isolation, the iserror test works fine,

IF(ISERROR(VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)),"",VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0))

as does the lookup where no value is recorded in the lookup array for that lookup value.
IF(VLOOKUP($A5,'FY11 QME'!$A$7:$G$346,7,0)=0,"",VLOOKUP($A5,'FY11 QME'!$A$7:$G$346,7,0))

any ideas?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I am having trouble getting the correct syntax for the following situation:

if the vlookup returns either 0 (where the lookup value is in the lookup array but without anything in the required column) or #N/A (where the lookup value is not in the look up arra at all), then give me a blank cell, else do the lookup

i have:

=IF(OR((VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)=0),ISERROR(VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0))),"",VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0))

no matter how i play around with this, I can't get it to return a blank cell when either of my conditions is met. in isolation, the iserror test works fine,

IF(ISERROR(VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)),"",VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0))

as does the lookup where no value is recorded in the lookup array for that lookup value.
IF(VLOOKUP($A5,'FY11 QME'!$A$7:$G$346,7,0)=0,"",VLOOKUP($A5,'FY11 QME'!$A$7:$G$346,7,0))

any ideas?
You have to test for the "iserror" first.

One way:

=IF(COUNTIF('FY11 QME'!$A$7:$A$346,$A6),IF(VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)="","",VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)),"")
 
Upvote 0
You have to test for the "iserror" first.

One way:

=IF(COUNTIF('FY11 QME'!$A$7:$A$346,$A6),IF(VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)="","",VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)),"")
If the value being returned is TEXT then we can shorten that a bit.

=IF(COUNTIF('FY11 QME'!$A$7:$A$346,$A6),T(VLOOKUP($A6,'FY11 QME'!$A$7:$G$346,7,0)),"")
 
Upvote 0
my thanks Mr Valko. I have used your first version as I am looking for numnber of spaces in transit. cheers.
 
Upvote 0

Forum statistics

Threads
1,203,514
Messages
6,055,842
Members
444,828
Latest member
StaffordStag

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