Sum a range based upon a criteria in ANOTHER column

  • Thread starter Thread starter Tom Jones
  • Start date Start date
T

Tom Jones

I have a table that is setup like:

A B
--------------------
1 $100 Y
2 $50 Y
3 $300 N

I need to sum everything in column A ONLY IF the "matching" value in column
B is "Y".

In the above example the result would be $150, ($100 + $50).

In C I could perform the above like this:

int sum = 0;
for (int i = 1; i <= 3; i++)
{
if (Worksheet[B, i] == "Y")
{
sum += Worksheet[A, i];
}
}

Any suggestions would be appreciated!

Thanks,
TJ
 
Norman Harker said:
Hi Tom!

Try:
=SUMIF(B:B,"Y",A:A)

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)

Thank you VERY much! I mistunderstood how sumif() worked...

Thanks!
TJ
 

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