how do I sum a column that has #NA as an answer to a lookup?

G

Guest

I am trying to add a column that has #NA as a result of using the Vlookup
function. I would like to add up the column that does not have #NA as an
answer.
 
P

Pete_UK

Change the cells with the vlookup formula in to this:

=IF(ISNA(your_formula),"",your_formula)

and copy down. The sum of this column should now work, but you could
change the "" in the middle to 0 (zero) if you prefer.

Hope this helps.

Pete
 
G

Guest

Hi Shreman,

Change your vlookup as-

=IF(ISERROR(<vlookup>),0,<vlookup>)

this will replace all the #N/A with 0 and your sum will work.
 
G

Guest

Best if you remove the #NA:

=if(ISNA(Vlookup),"",Vlookup)

or

=if(ISNA(Vlookup),0,Vlookup)
 
G

Guest

You want to avoid the NA's in the first place. Change your vlookups to
something like this...

if(countif(range, item) = 0, 0, vlookup(item, range, column, false))
or
if(isna(vlookup), 0, vlookup)

The first option is a bit more efficient but it is a bit more work to write...
 
P

Peo Sjoblom

=SUMIF(B2:B100,"<="&99^99)

will disregard any #N/A errors in B2:B100 although you might want to fix it
in the vlookup formulas instead by using IF(ISNA(Vlookup),"",Vlookup)
 
I

iliace

As an array formula (press Ctrl+Shift+Enter to confirm):

=SUM(IF(ISERROR(A1:A99),0,A1:A99))

Using error-checking in the lookup formula is a better approach, but
the above will work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top