how to Count cells in column B based on date in column A

ccreations2

New Member
Joined
Jul 14, 2013
Messages
2
Hello,
in cells A2:A200 i have dates, than in cells B2:B200 it either "TRUE or FALSE"
im looking for a formula in cell D4 to count how many TRUE cells per month in cell C3
see below how i need it to calculate


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Date[/TD]
[TD]Value[/TD]
[TD]Month to count[/TD]
[TD]count[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1/1/2019[/TD]
[TD]TRUE[/TD]
[TD]1/1/2019[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1/15/2019[/TD]
[TD]TRUE[/TD]
[TD]2/1/2019[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2/1/2019[/TD]
[TD]TRUE[/TD]
[TD]3/1/2019[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2/28/2019[/TD]
[TD]FALSE[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]3/1/2019[/TD]
[TD]TRUE[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]3/31/2019[/TD]
[TD]FALSE[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

i figured out the same idea is sum function as follows but need your help count function

in cell D2 =SUMIFS($B$2:$B$7,$A$2:$A$7,">="&C2,$A$2:$A$7,"<="&EOMONTH(C2,0))
in cell D3 =SUMIFS($B$2:$B$7,$A$2:$A$7,">="&C3,$A$2:$A$7,"<="&EOMONTH(C3,0))

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Date[/TD]
[TD]Value[/TD]
[TD]Month to sum[/TD]
[TD]sum[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1/1/2019[/TD]
[TD]1[/TD]
[TD]1/1/2019[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1/15/2019[/TD]
[TD]3[/TD]
[TD]2/1/2019[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2/1/2019[/TD]
[TD]1[/TD]
[TD]3/1/2019[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2/28/2019[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]3/1/2019[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]3/31/2019[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Thank You
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi, you are very close, this should work:


Book1
ABCD
1DateValueMonth to countcount
21/1/2019TRUE1/1/20192
31/15/2019TRUE2/1/20191
42/1/2019TRUE3/1/20191
52/28/2019FALSE
63/1/2019TRUE
73/31/2019FALSE
Sheet6
Cell Formulas
RangeFormula
D2=COUNTIFS($A$2:$A$7,">="&C2,$A$2:$A$7,"<="&EOMONTH(C2,0),$B$2:$B$7,TRUE)
 
Upvote 0
Just another option:

Code:
=SUMPRODUCT(($A$2:$A$7 >= C2)*($A$2:$A$7 <= EOMONTH(C2,0))*($B$2:$B$7=TRUE))
 
Upvote 0
Just another option:

Code:
=SUMPRODUCT(($A$2:$A$7 >= C2)*($A$2:$A$7 <= EOMONTH(C2,0))*($B$2:$B$7=TRUE))


Thank You, amazing! worked well....:)
I like the =sumproduct formula better, because im able to count column c as well
just 1 more question Mr Genius can this formula work with count cell with any value? not a specific like true, false, or at specified in the formula?
 
Upvote 0
Hi,

Glad could help! It can work with any value, instead of specifying TRUE or FALSE in a formula you can refer it to any cell, extending your problem where say column B had names and we wanted to find result for specific name then the same formula can be reused as shown below:


Book1
ABCDEF
1DateValueMonth to countcountNameABC
21/1/2019ABC1/1/20192
31/15/2019ABC2/1/20191
42/1/2019DEF3/1/20191
52/28/2019ABC
63/1/2019ABC
73/31/2019DEF
Sheet2
Cell Formulas
RangeFormula
D2=SUMPRODUCT(($A$2:$A$7 >= C2)*($A$2:$A$7 <= EOMONTH(C2,0))*($B$2:$B$7=$F$1))
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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