Count ifs with date range

Imran Azam

Board Regular
Joined
Mar 15, 2011
Messages
103
HI Guys

i am trying to create a formula where it does a count if the date range condition is matched else bring back blank, below is the data

[TABLE="width: 290"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Name[/TD]
[TD]State[/TD]
[TD][/TD]
[TD]Created On[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Qualified[/TD]
[TD][/TD]
[TD="align: right"]30/04/2019[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Qualified[/TD]
[TD][/TD]
[TD="align: right"]01/05/2019[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Qualified[/TD]
[TD][/TD]
[TD="align: right"]28/05/2019[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Qualified[/TD]
[TD][/TD]
[TD="align: right"]03/03/2019[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD="colspan: 2"]Not Qualified[/TD]
[TD="align: right"]04/05/2019[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Qualified[/TD]
[TD][/TD]
[TD="align: right"]05/05/2019[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Qualified[/TD]
[TD][/TD]
[TD="align: right"]06/05/2019[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD="colspan: 2"]Not Qualified[/TD]
[TD="align: right"]07/05/2019[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD="colspan: 2"]Not Qualified[/TD]
[TD="align: right"]08/05/2019
[/TD]
[/TR]
</tbody>[/TABLE]


the logic i am trying to use is if Name is Alex and State = Qualified and created on is between 01/05/2019 and 30/05/2019( i just want may data) then return the count of the name, the formula i have done is below but it isn't working

=COUNTIFS(Name,"Alex",state,"Qualified",Created on,">=01/05/2019",D:D,Created on,"<=30/5/2019)/COUNTIF(Name,"Alex")

can anyone help with this?

thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Is this what you want?
not exactly sure what you are trying to do.


Book1
ABCD
1NameStateCreated On
2AlexQualified4/30/2019
3AlexQualified5/1/2019
4AlexQualified5/25/2019
5AlexQualified3/3/2019
6JamesNot Qualified5/4/2019
7JamesQualified5/5/2019
8JamesQualified5/6/2019
9JamesNot Qualified5/7/2019
10JamesNot Qualified5/8/2019
11
12
13
142
Sheet1
Cell Formulas
RangeFormula
A14=COUNTIFS(A2:A10,"Alex",B2:B10,"qualified",D2:D10,">="&DATEVALUE("5/1/19"),D2:D10,"<="&DATEVALUE("5/30/19"))
 
Upvote 0
or
Code:
=SUMPRODUCT(--(A2:A10="Alex"),--(B2:B10="Qualified"),Month(C2:C10=5))
 
Last edited:
Upvote 0
Your formula has some errors:
A name cannot have a space, so Excel substitutes the space by a underscore
D:D is not correct
Missing a double-quote in 30/5/2015 (by the way the last day of May is 31)

See if this works
=COUNTIFS(Name,"Alex",State,"Qualified",Created_On,">=01/05/2019",Created_On,"<=31/5/2019")/COUNTIF(Name,"Alex")

Hope this helps

M.
 
Upvote 0
=SUMPRODUCT(--(A2:A10="Alex"),--(B2:B10="Qualified"),Month(C2:C10=5))
If you were to adopt an approach like this, you will probably want to include another clause for the year, otherwise you would return records for the month of May for ALL years, not just necessarily 2019.
 
Upvote 0
I think they don't have the parentheses in the correct place.
Try this:
Code:
=SUMPRODUCT(--(A2:A10="Alex"),--(B2:B10="Qualified"),--(MONTH(C2:C10)=5),--(YEAR(C2:C10)=2019))
 
Upvote 0
thanks what if i want the date range from 01/01.2019 to 01/05/2018, can this be done using same formula?
 
Upvote 0
assuming 2018 is a typo . .
Code:
=SUMPRODUCT(--(A2:A10="Alex"),--(B2:B10="Qualified"),--(MONTH(C2:C10)<5),--(YEAR(C2:C10)=2019))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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