If Statement Within VLOOKUP

SCWI

New Member
Joined
Jul 24, 2007
Messages
7
Hello...

I was wondering if anyone could help me with a VLOOKUP issue. Here is the equation that I have, which works fine: VLOOKUP(A4,'25 Client Revenue'!$A$1:$B$1521,2,FALSE). My question is, how can I add an if statement to this equation so that if the VLOOKUP does not find a match the cell is left blank and doesn't list #N/A. Thanks for your help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try this:
Code:
=IF(COUNTIF('25 Client Revenue'!$A$1:$B$1521,A4)=0,"",VLOOKUP(A4,'25 Client Revenue'!$A$1:$B$1521,2,FALSE))
 
Upvote 0
Hi to avoid the #N/A use the vlookup as

=if(isna(vlookup(_____________),0,vlookup(__________))

whereever the vlookup does not find the match it will return 0
and you will not get #N/A

Regards
Ranjit
 
Upvote 0
Hi to avoid the #N/A use the vlookup as

=if(isna(vlookup(_____________)),0,vlookup(__________))

whereever the vlookup does not find the match it will return 0
and you will not get #N/A

Regards
Ranjit
 
Upvote 0
Lewiy's formula can be slightly shortened, since a COUNTIF that returns 0 evaluates to FALSE. So...

=IF(COUNTIF('25 Client Revenue'!$A:$A,A4),VLOOKUP(A4,'25 Client Revenue'!$A$1:$B$1521,2,FALSE),"")
 
Upvote 0
Hello...

I was wondering if anyone could help me with a VLOOKUP issue. Here is the equation that I have, which works fine: VLOOKUP(A4,'25 Client Revenue'!$A$1:$B$1521,2,FALSE). My question is, how can I add an if statement to this equation so that if the VLOOKUP does not find a match the cell is left blank and doesn't list #N/A. Thanks for your help.

On Excel 2007...

=IFERROR(VLOOKUP(A4,'25 Client Revenue'!$A$1:$B$1521,2,0),"")

On prior versions...

1]

B4:

=IF(ISNA(C4),"",C4)

C4:

=VLOOKUP(A4,'25 Client Revenue'!$A$1:$B$1521,2,0)

2]

Code:
=IF(ISNUMBER(MATCH(A4,'25 Client Revenue'!$A$1:$A$1521,0)),
      VLOOKUP(A4,'25 Client Revenue'!$A$1:$B$1521,2,0),
      "")

which is faster than one with a CountIf test.

3]

If '25 Client Revenue'!$A$1:$B$1521 is sorted in ascending order...

Code:
=IF(LOOKUP(A4,'25 Client Revenue'!$A$1:$A$1521)=A4,
      LOOKUP(A4,'25 Client Revenue'!$A$1:$A$1521,
                        '25 Client Revenue'!$B$1:$B$1521)
      "")

would perform even better.
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

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