# If Statement Within VLOOKUP

#### SCWI

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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

#### Lewiy

##### Well-known Member
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))``

#### vranjit138

##### Board Regular
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

#### vranjit138

##### Board Regular
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

#### njimack

##### Well-known Member
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),"")

#### SCWI

##### New Member
It worked! Thanks very much for your help!

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

Replies
35
Views
600
Replies
1
Views
127
Replies
2
Views
247
Replies
5
Views
186
Replies
3
Views
267

### Forum statistics

1,186,163
Messages
5,956,289
Members
438,245
Latest member
bhavdip_mangukiya

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