Unable to add numbers from another sheet

  • Thread starter Thread starter UT
  • Start date Start date
U

UT

I have a sheet that imports data from a database. In another sheet I want to
add the numbers in a column B if the string in column Is "ABC".

I have tried different functions such as
"=SUMPRODUCT(--(Sheet1!B7:B238="ABC")*Sheet2!D7:D238)" AND
"=SUMIF(Sheet1!B7:B238,"ABC",Sheet1!D7:D238)"

Nothing seems to work. Any suggestion will be a great help. I am on deadline
here.

Thanks.
 
Why are you using sumproduct? SumIF should work

"=SUMIF(Sheet1!B7:B238,"ABC",Sheet1!D7:D238)"
 
Look for unseen characters like leading/trailing spaces in the ranges. The
numbers in column D may be TEXT.

I see you're referencing 2 different sheets.

See if this works:

=SUMPRODUCT(--(TRIM(Sheet1!B7:B238)="abc"),Sheet2!D7:D238+0)
 
"SUMIF" seems to be obvious choice but it shows a value of 0. Does it matter
that I am trying to add numbers imported from a database?

Thanks!!
 
Maybe your data that looks like numbers aren't really numbers.

If you put
=count(d7:d238)
what do you see?

This should count all the entries that are numeric.

If you see 0 with this formula, then maybe your data has extra stuff in the
cell.

Depending on what it is, there are different ways of cleaning this up.

David McRitchie has a macro:
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

And if you're new to macros, you may want to read David's intro:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

===
If that doesn't clean up all the data, you can use Chip Pearson's CellView Addin
to find out what's really in the cells:

http://www.cpearson.com/excel/CellView.aspx
 

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

Back
Top