Hi,
I have Vlookup Statement, which works fine.
I am trying to sum up the results of my Vlookup, but some results return a correct #N/A when the data is not found.
What is the best way to work around this issues?
Hi,
I have Vlookup Statement, which works fine.
I am trying to sum up the results of my Vlookup, but some results return a correct #N/A when the data is not found.
What is the best way to work around this issues?
Last edited by jpnyc; 05-06-2010 at 11:32 PM.
In Excel 2003, there's no choice but to test the data for a match first, it's basically double-dinging but what can you do?
=VLOOKUP(A1, B:C, 2, 0)
Could become:
=IF(ISERROR(VLOOKUP(A1, B:C, 2, 0)), "", VLOOKUP(A1, B:C, 2, 0))
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
I agree with Jbeaucaire on the returning of either blank or zero if there is no match in the VLOOKUP. However, in order to prevent double lookups as is done in nesting VLOOKUP in the IF Function, it could be more efficient to use a helper column to reference the result cell and then do the sum on the helper column.
Helper cell formula: = IF(ISNA(A1),0,A1)
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
If there's only one match you could use a SUMIF rather than a VLOOKUP - two birds etc...
The other alternative to "double dinging" using a VLOOKUP would be:
=LOOKUP(9.99E+307,CHOOSE({1,2},0,VLOOKUP(A1,B:C,2,0)))
the VLOOKUP is only evaluated once - 0 returned if no match found.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks