Function Problems

How to Automatically Generate Month Days and Weekdays in Excel

Ayan MasoodAyan Masood Oct 15, 2026 872 views

Question details

The user needs to create a dynamic Excel schedule that displays only the valid days and corresponding weekday names for a given month, ensuring the dates do not continue into the following month.

How to Automatically Generate Month Days and Weekdays in Excel
Product
Excel
Device & OS
not provided
Scenario
Creating automated monthly schedules, timesheets, or calendars where the number of days varies by month (e.g., 28, 30, or 31 days).
Observed behavior
The generated schedule accurately displays the days of the selected month and leaves the remaining cells blank instead of rolling over to the first days of the next month.
Before you start

Ensure you have a basic understanding of Excel's custom cell formatting. Decide which cell will serve as the starting point for the first day of your month.

Solution 1Recommended

Use IF and MONTH Functions (Compatible with All Versions)

This is the most reliable method for any version of Excel. It uses a logical test to compare the month of the next calculated date with the month of the starting date, returning a blank cell if they do not match.

By leveraging the IF and MONTH functions, Excel evaluates whether adding a day pushes the date into a new month. If it does, the formula stops generating dates and instead outputs an empty string. This prevents 30-day months or February from displaying the 1st or 2nd of the next month.

1
Enter the starting date

Select cell B1 and enter the first date of your desired month (e.g., 10/1/2023).

2
Apply the conditional date formula

In cell C1, enter the formula: =IF(MONTH(B1+1)=MONTH($B1),B1+1,"").

3
Fill the formula across the row

Select cell C1, grab the fill handle in the bottom-right corner, and drag it to the right through cell AF1 to cover a maximum of 31 days.

4
Format cells for weekday names

Highlight the range B1:AF1, right-click, and select Format Cells. Go to the Custom category and enter 'ddd' (for short names like Mon) or 'dddd' (for full names like Monday).

5
Add day numbers below the weekdays

In cell B2, enter the formula =B1. Drag this formula to the right through AF2. Finally, apply a Custom format of 'd' to the B2:AF2 range so it displays only the numerical day (1, 2, 3, etc.).

Use IF and MONTH Functions (Compatible with All Versions)
Leap Year Automatic Handling: Because this formula relies on Excel's internal date system, it will automatically account for leap years when generating dates for February.
Create Dynamic Calendars with WPS

Automate Your Monthly Schedules Easily in WPS Office

WPS Spreadsheet fully supports advanced date logic like IF, MONTH, and EOMONTH. You can easily build automated, error-free timesheets and schedules without worrying about incorrect days spilling into the next month.

  1. 1. Open a New Spreadsheet: Launch WPS Office, open a new Spreadsheet, and enter the first day of the month in cell B1.
  2. 2. Input the Logical Formula: In cell C1, type =IF(MONTH(B1+1)=MONTH($B1),B1+1,"") and press Enter.
  3. 3. Drag to Autofill: Click and hold the fill handle on C1, then drag horizontally to column AF to populate the month.
  4. 4. Apply Custom Formatting: Right-click the generated dates, choose Format Cells (or press Ctrl+1), navigate to Custom, and type 'ddd' to reveal weekday names.
100% compatibility with Microsoft Excel date and time functionsIntuitive Custom Format dialog for instantly converting dates to weekday namesLightweight, fast, and completely free to useFamiliar user interface with zero learning curve
microsoft office alternative - wps office

Frequently Asked Questions

How do I format the cells to show both the day and weekday in the same cell?

You can achieve this by changing the custom cell format. Right-click the cells, select Format Cells, choose Custom, and enter a format like 'ddd, d' (which will display as 'Mon, 1') or 'dddd, mmmm d' (which will display as 'Monday, October 1').

Why does my formula return a #VALUE! error towards the end of the month?

This error occurs if a subsequent formula attempts to perform arithmetic (like adding +1) to an empty text string ("") generated by the previous cell. The IF and MONTH formula structure provided prevents this by ensuring the blank string stops the calculation chain correctly, provided you drag the exact formula from C1.

How can I automatically highlight weekends in my generated schedule?

You can use Conditional Formatting. Select your generated date range (e.g., B1:AF1), go to Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter the formula =OR(WEEKDAY(B1)=1, WEEKDAY(B1)=7), then choose a background fill color to highlight Saturdays and Sundays.