How to count a range of different names from a range of dates?
Sheet A has a week ending date column (always Sunday). Sheet A also has a column called Manpower where I am trying to write a formula. Looks like this,
Sheet B Has an install date and an Installers Name. Looks like this,
The formula I am trying to write would find all dates from Sheet B that fall within the week ending date of Sheet A and count the number of (different installers *8) *5.
Any help from the community would be very appreciated...
Best Answer
-
Looks like you need to wrap your greater than range in () as it's not capturing the -7, so:
=COUNT(DISTINCT(COLLECT({FPR 2024 020124 Range installers}, {FPR 2024 020124 Range Install Date}, <=[2024 Week Ending]@row, {FPR 2024 020124 Range Install Date}, >([2024 Week Ending]@row - 7))))
Jason Tarpinian - Sevan Technology
Smartsheet Aligned Partner
Answers
-
So this formula would count up your distinct number of INSTALLERS based upon some date fields you could reference. So as a breakdown, it is:
- collecting all of your INSTALLERS that the INSTALL DT is less than or equal to this Sunday, but greater than last Sunday
- The taking the distinct value of installers within that range
- Then counting them
- So below we collected John, John, Tyler, Caleb. And returned 3, as John is listed twice, but thanks to DISTINCT is only counted once.
=COUNT(DISTINCT(COLLECT(INSTALLER:INSTALLER, [INSTALL DT]:[INSTALL DT], <=[2024 Week Ending]5, [INSTALL DT]:[INSTALL DT], >[2024 Week Ending]4)))
and because I love the extra security (harder for people to delete!) column formulas, this would do the same thing, but as a column formula (with a helper)
=COUNT(DISTINCT(COLLECT(INSTALLER:INSTALLER, [INSTALL DT]:[INSTALL DT], <=[2024 Week Ending]@row, [INSTALL DT]:[INSTALL DT], >IF([Row #]@row = 1, [2024 Week Ending]@row - 7, INDEX([2024 Week Ending]:[2024 Week Ending], MATCH([Row #]@row - 1, [Row #]:[Row #], 0))))))
With helper column of "Row #" calculated as
=MATCH([Row ID]@row, [Row ID]:[Row ID])
where "Row ID" is the system generated column.
Jason Tarpinian - Sevan Technology
Smartsheet Aligned Partner
-
@Jason Tarpinian Thank you very much for your reply. Thanks to you I am closer, just not quite there.
This is how I altered your formula to use range references. =COUNT(DISTINCT(COLLECT({FPR 2024 020124 Range installers}, {FPR 2024 020124 Range Install Date}, <=[2024 Week Ending]@row, {FPR 2024 020124 Range Install Date}, >[2024 Week Ending]@row - 7)))
And I used these ranges from another sheet.
It returns a value of 1 when it should return a value of 9. 9 distinct installers were used from 01/01/24 to 01/07/24. Any additional help you would consider offering would be appreciated. Thank you...
-
Looks like you need to wrap your greater than range in () as it's not capturing the -7, so:
=COUNT(DISTINCT(COLLECT({FPR 2024 020124 Range installers}, {FPR 2024 020124 Range Install Date}, <=[2024 Week Ending]@row, {FPR 2024 020124 Range Install Date}, >([2024 Week Ending]@row - 7))))
Jason Tarpinian - Sevan Technology
Smartsheet Aligned Partner
-
@Jason Tarpinian This worked! Thank you for your help!!!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 437 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!