Countifs / sumproducts to count value based on column header

p4nny

Board Regular
Joined
Jan 13, 2015
Messages
246
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]06/10/2017[/TD]
[TD]29/09/2017[/TD]
[TD]22/09/2017[/TD]
[/TR]
[TR]
[TD]BA1[/TD]
[TD]y[/TD]
[TD]y[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]BA2[/TD]
[TD]Y[/TD]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD]BA3[/TD]
[TD]y[/TD]
[TD]y[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]BA4[/TD]
[TD][/TD]
[TD][/TD]
[TD]y[/TD]
[/TR]
</tbody>[/TABLE]


Hi,

This is an example of how my dataset looks.

I'm looking to count the number of "Y"'s in any specified week so if I type 22/09/2017 in a cell, it would count the number of "Y"'s in that column

Much appreciated

Many thanks in advance,
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi

B1:D1 houses the dates, in W1 = 22/09/2017


=SUMPRODUCT((B2:D100="Y")*(B1:D1=W1))

----

If you'd need to add another condition (example: "Y" per "BA3" under date in W1):

=SUMPRODUCT((B2:D100="Y")*(B1:D1=W1)*(A2:A100="BA3"))


Regards
 
Last edited:
Upvote 0
Great thank you..

Rather than "Y", if I was have a criteria of "DOES NOT EQUAL BLANK", how would I do that?

Many thanks again
 
Upvote 0
Hi again

same data layout

=SUMPRODUCT((B2:D100<>"")*(B1:D1=W1))

=SUMPRODUCT(NOT(ISBLANK(B2:D100))*(B1:D1=W1))

Regards
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,633
Members
452,661
Latest member
Nonhle

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