![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
I am doing a vlookup function and I sum the results. But how do I get the vlookup function to display "0" if there is no value for what it is looking for. I was trying to do a if function but it didn't work. Any suggestions. Thanks
|
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
=SUMIF(range,"<>#N/A") or, use: =IF(COUNTIF(B2:B100,A1),VLOOKUP(A1,B2:G100,2),0) to return 0 instead of #N/A when appropriate. Aladin |
|
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
=IF(ISNA(your_vlookup_formula),0,(your_vlookup_formula)) HTH _________________ Yogi Anand Edit: Deleted reference to inactive web site from signature line [ This Message was edited by: Yogi Anand on 2003-01-19 18:34 ] |
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Or, have an additional column containing the formula, =IF(ISNA(A1),0,A1), where A1 contains your VLOOKUP. You may choose to hide column A so that viewers of the worksheet are oblivious to the presence of #N/A errors. I believe this is preferrable to a formula that performs your VLOOKUP (or otherwise examines your table array) twice!
[ This Message was edited by: Mark W. on 2002-04-24 16:50 ] |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
|
|
|
|
|
|
|
#6 | ||
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
My preferred design is not to perform an exact match lookup. Retrieve the results and compare it against the original lookup value. This can be quite a time saver if the hit rate is low. [ This Message was edited by: Mark W. on 2002-04-24 16:41 ] |
||
|
|
|
|
|
#7 | |||
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
|
|||
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
I would to use Yogi's formula because I feel I won't have to do much but I get an error message, any suggestions?
Thanks |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
Maybe it will help if I put the vlookup formula.
=VLOOKUP(B8,display2002,2,FALSE) |
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|