Count Dates in a Table using Today's Date and only visible rows

Jborgen

New Member
Joined
Aug 27, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello All,
I have a table I am using to create a dashboard from. The table holds multiple columns and one of them being a date column. What I need to do is be able to filter the table by person and then count the dates that are within the current week we are in (Sunday through Saturday). I have tried using the SumProduct but I am struggling to get it work properly.
 

Attachments

  • Dashboard.jpg
    Dashboard.jpg
    70.2 KB · Views: 15
  • Table.jpg
    Table.jpg
    146.3 KB · Views: 15

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
It's not 100% clear what you're after, but hopefully I've interpreted correctly.
In the example below, the formula in J2 will return all the project IDs in the current week (Sunday to Saturday) assigned to John.
Book1
ABCDEFGHIJ
1Project IDPMDue date
25900John28/08/20245900
35922Paul26/08/20246024
45657George20/08/20245948
55914Ringo29/08/20245957
66024John28/08/2024
76046Paul26/08/2024
85323George28/08/2024
96025Ringo2/09/2024
105948John30/08/2024
115322Paul3/09/2024
125537George3/09/2024
135771Ringo28/08/2024
145957John26/08/2024
155936Paul20/08/2024
165524George22/08/2024
Sheet2
Cell Formulas
RangeFormula
J2:J5J2=FILTER(A2:A16,(H2:H16>=1-WEEKDAY(TODAY())+TODAY())*(H2:H16<=7-WEEKDAY(TODAY())+TODAY())*(C2:C16="John"))
Dynamic array formulas.
 
Upvote 0
Try. In K2.
Excel Formula:
=LET(a,$C$2:$C$16,dt,$H$2:$H$16,BYROW(a,LAMBDA(ro,IF(COUNTIF($C$1:ro,ro)=1,SUMPRODUCT((a=ro)*(dt>=(TODAY()-WEEKDAY(TODAY(),1)+1))*(dt<=(TODAY()+7-WEEKDAY(TODAY(),1)))),""))))
 
Upvote 0
Hi & welcome to MrExcel.
Another option that will not count hidden rows
Fluff.xlsm
ABCDEFGHIJ
1Project IDPMDue dateJohn
25900John25/08/20245
35922Paul26/08/2024
45657George20/08/2024
55914Ringo29/08/2024
66024John28/08/2024
76046Paul26/08/2024
85323George28/08/2024
96025john31/08/2024
105948John30/08/2024
115322Paul03/09/2024
125537George03/09/2024
135771Ringo28/08/2024
145957John26/08/2024
155936Paul20/08/2024
165524George22/08/2024
Data
Cell Formulas
RangeFormula
J2J2=LET(d,H2:H100,n,C2:C100,ROWS(FILTER(d,(WEEKNUM(+d,1)=WEEKNUM(TODAY(),1))*(n=J1)*(MAP(d,LAMBDA(m,SUBTOTAL(103,m)))))))
 
Upvote 0
Try. In K2.
Excel Formula:
=LET(a,$C$2:$C$16,dt,$H$2:$H$16,BYROW(a,LAMBDA(ro,IF(COUNTIF($C$1:ro,ro)=1,SUMPRODUCT((a=ro)*(dt>=(TODAY()-WEEKDAY(TODAY(),1)+1))*(dt<=(TODAY()+7-WEEKDAY(TODAY(),1)))),""))))
Thank you. This is close. I feel like I need to explain a little more. Sorry.

So I have the Dashboard on one sheet where I want cell D21 to return a total count of dates that are in the current week based on today's date in a table on the PO Report sheet. On the Dashboard sheet I also have a filter that will be applied to the table for each person. For Example, Cfrank will be able to filter to their projects only and then I want the number on the Dashboard sheet to reflect the total number of dates within the current week based on today's date.

So the name is not really important in the formula. It's more about counting the dates in the table for the current week based on today's date when the table is filtered by any name. Additional screenshots to hopefully help.

Thanks!
 

Attachments

  • Dashboard Screen.jpg
    Dashboard Screen.jpg
    180.4 KB · Views: 3
  • PO Report Table Screen.jpg
    PO Report Table Screen.jpg
    182.3 KB · Views: 2
  • Sheet Names.jpg
    Sheet Names.jpg
    49.4 KB · Views: 3
Upvote 0
If your not interested in the name, try
Excel Formula:
=LET(d,H2:H100,n,C2:C100,ROWS(FILTER(d,(WEEKNUM(+d,1)=WEEKNUM(TODAY(),1))*(MAP(d,LAMBDA(m,SUBTOTAL(103,m)))))))
 
Upvote 0
Solution
If your not interested in the name, try
Excel Formula:
=LET(d,H2:H100,n,C2:C100,ROWS(FILTER(d,(WEEKNUM(+d,1)=WEEKNUM(TODAY(),1))*(MAP(d,LAMBDA(m,SUBTOTAL(103,m)))))))
This worked Perfectly!!!!

Thank you!!!!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Glad we could help & thanks for the feedback.
Sorry to bother you again. :)
What if I wanted the dates in the Next Week. Not a rolling 7 days from TODAY but just dates that occur in the next week Sunday to Saturday?
Thanks!
 
Upvote 0
Just add 7 to the TODAY function.
 
Upvote 0

Forum statistics

Threads
1,221,519
Messages
6,160,294
Members
451,636
Latest member
ddweller151

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