Count filtered unique values where sum of values in another column meets criteria

excelhelppleas

New Member
Joined
Apr 19, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello, hope you can help. I would like to use a formula to give the count of complete projects in [time range] where there is a total of <=1 hour spent on 'review' over the whole project - example sheet below. In this sample the desired answer is 2 as only project A and B meet the criteria.

dateprojectproject statustasktime (hours)
01/01/2021​
Project ACompletedraft
0.5​
01/01/2021​
Project ACompletereview
0.5​
02/01/2021​
Project ACompletereport
1​
03/01/2021​
Project ACompletereview
0.5​
04/01/2021​
Project ACompletepublish
0.5​
05/01/2021​
Project BCompletedraft
1​
05/01/2021​
Project BCompletereview
1​
06/01/2021​
Project BCompletepublish
0.5​
07/01/2021​
Project CCompletereview
1.5​
08/01/2021​
Project DDroppeddraft
2​
09/01/2021​
Project DDroppedreport
0.5​
10/01/2021​
Project DDroppedreview
0.5​
11/01/2021​
Project DDroppedreview
1​
12/01/2021​
Project EIn Progressdraft
1​
13/01/2021​
Project EIn Progressreview
0.5​

I can count the number of projects which are complete, where time was spent on 'review' and which were undertaken between two dates using this formula but don't know how to integrate the filter / sumif for the time spent on review.

=SUM(--(LEN(UNIQUE(FILTER(B:B,(A:A>=DATE(2021,1,1))*(A:A<=DATE(2021,12,31))*(D:D="review")*(C:C="Complete"),"")))>0))

Any suggestions appreciated.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
As you are using the FILTER function - are you using Excel 2016?
 
Upvote 0
Strange, my version of Excel 2016 does not have the filter function, only FILTERXML.
 
Upvote 0
Think i took a long way round but the below may help:
Book1
ABCDEFGH
1dateprojectproject statustasktime (hours)
201/01/2021Project ACompletedraft0.52
302/01/2021Project ACompletereview0.5
403/01/2021Project ACompletereview0.5
504/01/2021Project ACompletereport1
605/01/2021Project ZCompletereview0.5
705/01/2021Project ACompletereview0.5
806/01/2021Project ACompletepublish0.5
907/01/2021Project BCompletedraft1
1008/01/2021Project BCompletereview1
1109/01/2021Project BCompletepublish0.5
1210/01/2021Project CCompletereview1.5
1311/01/2021Project DDroppeddraft2
1412/01/2021Project DDroppedreport0.5
1513/01/2021Project DDroppedreview0.5
1614/01/2021Project DDroppedreview1
1715/01/2021Project EIn Progressdraft1
1816/01/2021Project EIn Progressreview0.5
Sheet1
Cell Formulas
RangeFormula
H2H2=LET(u,UNIQUE(FILTER(B2:B18,C2:C18="Complete")),s,SUMIFS(E2:E18,D2:D18,"Review",C2:C18,"Complete",B2:B18,u),COUNT(FILTER(s,s<=1)))
 
Upvote 0
Hi - unfortunately this doesn't work as it returns 32 matches for <1 hour when my dataset only has 28 total projects for the year.
 
Upvote 0
Hi - unfortunately this doesn't work as it returns 32 matches for <1 hour when my dataset only has 28 total projects for the year.
sorry pressed enter too soon - I added a date filter into your formula within the UNIQUE criteria similar to my initial formula, and I wonder if that is the wrong way to go about filtering for date in your solution. thanks for your help, by the way!
 
Upvote 0
I see, will be easier to see what is going on if we had some more data to look at, have you tried the XL2BB add in that is available on this forum?

XL2BB allows you to upload part of your workbook for us to look at what you are looking at OR a mock up of what you are looking at. I used it in post 6.
 
Upvote 0
I see, will be easier to see what is going on if we had some more data to look at, have you tried the XL2BB add in that is available on this forum?

XL2BB allows you to upload part of your workbook for us to look at what you are looking at OR a mock up of what you are looking at. I used it in post 6.
Unfortunately I can't share the actual data. However I cut out most of the extra results by specifying for D:D = 'review' within the UNIQUE criteria.

=LET(
u,UNIQUE(FILTER(B:B,C:C="Complete"*(A:A>=DATE(2021,1,1))*(A:A<=DATE(2021,12,31))*(D:D="Review"))),
s,SUMIFS(E:E,D:D,"Review",C:C,"Complete",B:B,u),
COUNT(FILTER(s,s<=1)))

There are still a couple extra in my total which are being double-counted across the years as they have line entries in Dec 21 and Jan 22 (e.g.) so show up in the formula for both 2021 and 2022. Is there a way to exclude entries which have 'review' lines in a prior year?
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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