Return dates in month based on cell value

Nat321

New Member
Joined
Aug 7, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello everyone!

I'm trying to include an "interactive" button/slicer option to list out all dates in the current month, based on the day in column D.
If I click on D2, K2 to K5 will list out all all Tuesdays based on K1.
K1 =today()

TIA!

1659853448983.png
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hello everyone!

I'm trying to include an "interactive" button/slicer option to list out all dates in the current month, based on the day in column D.
If I click on D2, K2 to K5 will list out all all Tuesdays based on K1.
K1 =today()

TIA!

View attachment 71011
Adding on as a reply as I can't find the edit option.

Is there a simpler way than listing out all dates in the year and use it as a database for the slicer?
 
Upvote 0
Consider the following
1 You can use Tuesday or Tue
2 You can use name manager to name DOWS ={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"} but that is not essential.
3 "Is there a simpler way than listing out all dates in the year and use it as a database for the slicer?" What dates do you want listed?

T202208a.xlsm
ABK
1DayAugust 7, 2022
21TuesdayTue, Aug 02, 2022
32Tue, Aug 09, 2022
43Tue, Aug 16, 2022
54Tue, Aug 23, 2022
65Tue, Aug 30, 2022
76
87
2e
Cell Formulas
RangeFormula
K2K2=WORKDAY.INTL($K$1-DAY($K$1)+1,A2,REPLACE("1111111",MATCH(LEFT($B$2,3),{"Mon","Tue","Wed","Thu","Fri","Sat","Sun"},0),1,0))
K3:K6K3=WORKDAY.INTL($K$1-DAY($K$1)+1,A3,REPLACE("1111111",MATCH(LEFT($B$2,3),DOWS,0),1,0))
 
Upvote 0
Solution
Consider the following
1 You can use Tuesday or Tue
2 You can use name manager to name DOWS ={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"} but that is not essential.
3 "Is there a simpler way than listing out all dates in the year and use it as a database for the slicer?" What dates do you want listed?

T202208a.xlsm
ABK
1DayAugust 7, 2022
21TuesdayTue, Aug 02, 2022
32Tue, Aug 09, 2022
43Tue, Aug 16, 2022
54Tue, Aug 23, 2022
65Tue, Aug 30, 2022
76
87
2e
Cell Formulas
RangeFormula
K2K2=WORKDAY.INTL($K$1-DAY($K$1)+1,A2,REPLACE("1111111",MATCH(LEFT($B$2,3),{"Mon","Tue","Wed","Thu","Fri","Sat","Sun"},0),1,0))
K3:K6K3=WORKDAY.INTL($K$1-DAY($K$1)+1,A3,REPLACE("1111111",MATCH(LEFT($B$2,3),DOWS,0),1,0))
Thanks! It works, but i'm not sure of the need to replace 1111111?

3) I listed out all the dates in the year and just copied the result out...
1659887184915.png
 
Upvote 0
"Thanks! It works, but i'm not sure of the need to replace 1111111?"

You want to specify a variable day of the week. This part of the formula replaces the 1 with a 0 for the selected Day of the week.
Review the formula with Excels Formula Evaluate Formula and review Excel's help for Workday.intl.
 
Upvote 0
"Thanks! It works, but i'm not sure of the need to replace 1111111?"

You want to specify a variable day of the week. This part of the formula replaces the 1 with a 0 for the selected Day of the week.
Review the formula with Excels Formula Evaluate Formula and review Excel's help for Workday.intl.
Understood. Thanks Dave for your help!
 
Upvote 0
Thanks for the feedback.
A slightly different approach and also using Let to show blank where necessary.

T202208a.xlsm
AB
20RequireFri
21For dateSun Aug 07, 22
22Fri Aug 05, 22
23Fri Aug 12, 22
24Fri Aug 19, 22
25Fri Aug 26, 22
26
2e
Cell Formulas
RangeFormula
B22:B26B22=LET(x,WORKDAY.INTL($B$21-DAY($B$21)+1,ROW()-21,REPLACE("1111111",MATCH(LEFT($B$20,3),DOWS,0),1,0)),IF(x>EOMONTH($B$21,0)," ",x))
 
Upvote 0

Forum statistics

Threads
1,215,174
Messages
6,123,454
Members
449,100
Latest member
sktz

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