Count within Date Range only if valid criteria

dingo114

New Member
Joined
May 20, 2014
Messages
9
Hi everyone,

In an employee list, I am trying to count all leavers in a month based on their position.

So far I have:
=SUMPRODUCT((P4:P719>='startdate')*(P4:P719<='enddate))

which counts all leavers and works like a charm... but I can't get it to count only the leavers with position "SM" which is stored in column T ...

can anyone help out here????

Many thanks!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi everyone,

In an employee list, I am trying to count all leavers in a month based on their position.

So far I have:
=SUMPRODUCT((P4:P719>='startdate')*(P4:P719<='enddate))

which counts all leavers and works like a charm... but I can't get it to count only the leavers with position "SM" which is stored in column T ...

can anyone help out here????

Many thanks!

how about this assuming cells in column T hold for example "SM" only.
=SUMPRODUCT(--(P4:P719>='startdate'),--(P4:P719<='enddate'),--(T4:T719="SM"))

whereas a cells in column T may hold for example "SM somethingsomething"
=SUMPRODUCT(--(P4:P719>='startdate'),--(P4:P719<='enddate'),--(T4:T719="SM*"))
 
Upvote 0
how about this assuming cells in column T hold for example "SM" only.
=SUMPRODUCT(--(P4:P719>='startdate'),--(P4:P719<='enddate'),--(T4:T719="SM"))

whereas a cells in column T may hold for example "SM somethingsomething"
=SUMPRODUCT(--(P4:P719>='startdate'),--(P4:P719<='enddate'),--(T4:T719="SM*"))


Hi Gilliam,

thanks for your quick reply.

I tried that but get a "Value" error.

:-(
 
Upvote 0
My start date would be 1/7/2014 and end date 31/7/2014

In column T there are 3 options:
ASM
SM
Casual

A4: 1-Jul-14

B4: 31-Jul-14

C4: SM

1.

=SUMPRODUCT(--(P4:P719>=A4),--(P4:P719<=B4),--(T4:T719=C4))

2.

=COUNTIFS(P4:P719,">="&A4,P4:P719,"<="&B4,T4:T719,C4)

The latter is faster than the former. The count is based on SM, not on SM* or on *SM.

Do you want to count in both ASM and SM occurrences in the data?
 
Upvote 0
Hi Aladin,

I just came back from annual leave and tried it... it works perfect! thank you!

I do want to count both but in separate cells so I just created multiple formulas based on your feedback

thanks everyone!
 
Upvote 0
Hi Aladin,

I just came back from annual leave and tried it... it works perfect! thank you!

I do want to count both but in separate cells so I just created multiple formulas based on your feedback

thanks everyone!

You are welcome. Thanks for providing feedback.
 
Upvote 0

Forum statistics

Threads
1,222,903
Messages
6,168,939
Members
452,227
Latest member
sam1121

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