Conditional Adding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Excel 2003 and would like to avoid using VBA code if possible.

I have two columns (A & B) with 12 cells used, and a cell further down (C22)
where the sum of Column B is added up.

What I need to do is have Column A have either Yes Or No (I know I can do
this with a list). The trick is that in cell C22 (The Sum) I need it to only
add the data in Column B IF the corresponding cell in Column A has "Yes".

I know there has to be a way to do this! It's driving me batty! Please help!
Thank You!
 
I had to make some modifications to that to fit a criteria I forgot to
include, but you answer was the basis to my now well working formula :D Thank
You!
 
Sun, 7 Oct 2007 10:26:01 -0700 from GoodTrouble
I am using Excel 2003 and would like to avoid using VBA code if possible.

I have two columns (A & B) with 12 cells used, and a cell further down (C22)
where the sum of Column B is added up.

What I need to do is have Column A have either Yes Or No (I know I can do
this with a list). The trick is that in cell C22 (The Sum) I need it to only
add the data in Column B IF the corresponding cell in Column A has "Yes".

SUMPRODUCT is your friend.

=SUMPRODUCT(--(A1:A12="Yes"),(B1:B12))

See this excellent page by Bob Phillips:
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
 
Back
Top