Countifs or sumproduct - date range and multiple criteria

Sirod

New Member
Joined
Aug 6, 2009
Messages
47
Hello,

I have a list of employees who were assigned tasks for different projects. The list includes details such as task status, task start date, task end date, and what project the task is associated with. Please see the below table for a snapshot.

1629755624620.png


I now need to count the number of people who worked on a task in a given year, counted by date range, project, and status. The employee may have started the task in one year and not completed it until a later year. For example, if they started the task in 2018 and completed it in 2020, they would be counted in each year for 2018 (start), 2019, and 2020 (completed) - so three times. I’m not sure if I need a countifs, sumproduct, or a combination of both. Please see the below table. I did do a manual count to fill in a few of the easier cells to give an idea of what I need – hope it helps!

1629755736639.png


Many thanks.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Maybe try this sumproduct, although it is producing different results from your manual count;

Countifs or sumproduct - date range and multiple criteria - Sirod.xlsx
ABCDE
1nameprojecttask statusstartend
2Employee 1Project ACompleted2017-05-212021-07-09
3Employee 2Project ACompleted2017-05-132019-01-25
4Employee 3Project ACompleted2017-05-132018-01-31
5Employee 4Project ACompleted2018-07-152018-08-28
6Employee 5Project ACompleted2018-07-082021-01-31
7Employee 6Project BIncomplete2020-11-012020-11-22
8Employee 7Project CCompleted2019-01-032019-05-31
9Employee 8Project ACompleted2019-07-142019-05-31
10Employee 9Project AIn Progress2019-04-21
11Employee 10Project ACompleted2020-09-182020-11-08
12Employee 11Project BIn Progress2020-07-03
13Employee 12Project BIn Progress2017-05-07
14Employee 13Project BIn Progress2019-08-14
15Employee 14Project CIn Progress2020-01-14
16Employee 15Project ACompleted2019-01-132020-01-20
Sheet1


Countifs or sumproduct - date range and multiple criteria - Sirod.xlsx
ABCDE
1YearProjectCompletedIn ProgressIncomplete
22017-01-01Project A 1
32017-01-01Project B3
42017-01-01Project C1
52018-01-01Project A11
62018-01-01Project B2
72018-01-01Project C1
82019-01-01Project A11
92019-01-01Project B2
102019-01-01Project C11
112020-01-01Project A1
122020-01-01Project B11
132020-01-01Project C1
142021-01-01Project A
152021-01-01Project B
162021-01-01Project C
Sheet2
Cell Formulas
RangeFormula
C2C2=SUMPRODUCT((Sheet1!$D$2:$D$16>=$A2)*(Sheet1!$E$2:$E$16<=EOMONTH($A2,11))*(Sheet1!$B$2:$B$16=$B2)*(Sheet1!$C$2:$C$16=C$1))
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Since we cannot copy data from an image like you posted, you should also investigate this:
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

There is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Regarding my first paragraph above, IF you have Microsoft 365, you could try this.

Sirod.xlsm
ABCDEFGHIJK
1nameprojecttask statusstartendYearProjectCompletedIn ProgressIncomplete
2Employee 1Project ACompleted21/05/20179/07/20212018Project A500
3Employee 2Project ACompleted13/05/201725/01/20192018Project B010
4Employee 3Project ACompleted13/05/201731/01/20182018Project C000
5Employee 4Project ACompleted15/07/201828/08/20182019Project A510
6Employee 5Project ACompleted8/07/201831/01/20212019Project B020
7Employee 6Project BIncomplete1/11/202022/11/20202019Project C100
8Employee 7Project CCompleted3/01/201931/05/20192020Project A410
9Employee 8Project ACompleted14/07/201931/05/20192020Project B031
10Employee 9Project AIn Progress21/04/20192020Project C010
11Employee 10Project ACompleted18/09/20208/11/2020
12Employee 11Project BIn Progress3/07/2020
13Employee 12Project BIn Progress7/05/2017
14Employee 13Project BIn Progress14/08/2019
15Employee 14Project CIn Progress14/01/2020
16Employee 15Project ACompleted13/01/201920/01/2020
17
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,580
Members
452,653
Latest member
craigje92

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