Formula Filled Dates

J_K

New Member
Joined
Oct 3, 2023
Messages
2
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
On the sheet I am working on, I want cells to automatically fill the numbers of the days of the month and names of the days based on what month and year is entered into two separate cells. I have this pretty much figured out with

=DAY(DATE($A9,MONTH(1&$B9),1))

and

=CHOOSE(WEEKDAY(DATE($A9,MONTH(1&$B9),DAY(DATE($A9,MONTH(1&$B9),1)))),"Sun","Mon","Tue","Wed","Thu","Fri","Sat")

But for months with fewer than 31 days, it rolls in to the next month. Instead, I want it to leave those columns beyond the end of the month blank.

This is an example of what I am talking about:

2023February12345678910111213141516171819202122232425262728123
EMPLOYEE NAMEWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFri

Any advice?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi & welcome to MrExcel.
For 365 how about
Fluff.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAE
8
92023February12345678910111213141516171819202122232425262728
10EMPLOYEE NAMEWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTue
Data
Cell Formulas
RangeFormula
C9:AD10C9=LET(d,DATE(A9,MONTH(1&B9),1),VSTACK(SEQUENCE(,DAY(EOMONTH(d,0))),TEXT(SEQUENCE(,DAY(EOMONTH(d,0)),d),"ddd")))
Dynamic array formulas.
 
  • Like
Reactions: J_K
Upvote 0
Solution
If it needs to work in 2021 another option
Fluff.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACAD
92023February12345678910111213141516171819202122232425262728
10EMPLOYEE NAMEWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTue
Data
Cell Formulas
RangeFormula
C9:AD9C9=LET(d,DATE(A9,MONTH(1&B9),1),SEQUENCE(,DAY(EOMONTH(d,0)),d))
C10:AD10C10=TEXT(C9#,"ddd")
Dynamic array formulas.


And format C9:AG9 to show the day only
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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