Sum up cells based on the value yes/no

Karlbirger

Board Regular
Joined
Sep 21, 2011
Messages
68
Hi guys,

I have two columns, A and B. In column A the value can be either "Yes" or "No".
I have problems to engineer a formula that sum up all cells in column B where the equivalent cells in column A equals "Yes".
Is this possible to construct in Worksheet_SelectionChange and add to a specific cell so I dont have to update it manually to see the total value?

Thanks for the help.

Regards
KB
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If I would like to add an extra cell in column C, e.g the value 2011 (the year of today), can I add this into the code

Code:
=SUMIF(H:H;"Yes";AI:AI)

in any way?

In other words: If the cell in column A says "Yes" and the cell in column C says "2011", then sum up the equivalent cells in column B.

Thanks in advance
KB
 
Upvote 0
Cant really get that code to work. I wrote:

Code:
=SUMPRODUCT(;(A1:A1000="Yes");(C1:C1000=2011);B1:B1000)

I have tried this one too but it gives me an error:

Code:
=SUMIFS(B:B;A:A;"Yes";C:C;"2011")

Shouldnt SUMIFS be appropriate here?
 
Upvote 0
Works, but it returns "0", which it shouldn't. There are values in column B that have equivalent values of "Yes" and "2011".

Any ideas?
 
Last edited:
Upvote 0
In column C are the values actually 2011 or are they dates formatted to show only the year?
 
Upvote 0

Forum statistics

Threads
1,203,462
Messages
6,055,565
Members
444,799
Latest member
CraigCrowhurst

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top