Creating a Calendar

Written by Allen Wyatt (last updated December 20, 2025)
This tip applies to Excel Excel in Microsoft 365


2

Nancy wonders if she can use the various new array functions in Excel to create a calendar for a given month in a traditional seven-column, Sunday through Saturday format.

A calendar like Nancy is looking for is nothing but a seven-column grid in which the first day of the month appears in one of the seven cells in the first row. Assuming the beginning day of the desired month is in cell A1, then the grid can be accomplished with this formula:

=SEQUENCE(6,7,A1-WEEKDAY(A1)+1)

Again, cell A1 contains a date such as 1/1/26, which is the first day of the desired month's calendar. You can finish out the calendar by adding a header row (Sun, Mon, Tue, etc.) and changing the formatting of the cells containing dates that are not within the desired month. You can also format the rest of the cells in the grid to show the dates as desired.

If you think that the date in A1 could be any date and you want to automatically hide the dates that are not in the current month, then the formula because slightly more complex. This version uses the LET function to define variables that are helpful in putting together the grid.

=LET(m,MONTH(A1), beg,DATE(YEAR(A1),m,1), grid,SEQUENCE(6,7,beg-WEEKDAY(beg)+1), IF(MONTH(grid)=m,grid,""))

Notice that the formula defines the month of the date (m), the first day of that month (beg), and the grid array itself (grid). Constructing the grid array is done using the same SEQUENCE formula previously used. The IF formula only checks the dates in the grid to determine if they are in the correct month or not. If so, then the date is displayed; if not, then an empty string is displayed. You will still need to format the dates in the returned grid to appear as you desire and add the header row for the grid.

The formula can be slightly expanded it you want the header row added automatically, in this fashion:

=LET(m,MONTH(A1), beg,DATE(YEAR(A1),m,1), grid,SEQUENCE(6,7,beg-WEEKDAY(beg)+1), cal,IF(MONTH(grid)=m,grid,""), VSTACK({"Sun","Mon","Tue","Wed","Thu","Fri","Sat"},cal))

In this variation, the calendar, containing the valid within-month dates, was assigned to the cal variable. Finally, VSTACK was used to add the days of the week (the header row) to what is returned by the formula.

All of the formulas so far return date values which need to be formatted to display in the format you desire. A final change to the formula can be used to return only the day of the month, 1 through 31.

=LET(m,MONTH(A1), beg,DATE(YEAR(A1),m,1), grid,SEQUENCE(6,7,beg-WEEKDAY(beg)+1), cal,IF(MONTH(grid)=m,DAY(grid),""), VSTACK({"Sun","Mon","Tue","Wed","Thu","Fri","Sat"},cal))

The only change in this formula was to, within the IF structure, wrap the grid variable within the DAY function.

Finally, if you want to add a month and year just above the column headers, then you could add an additional variable (mtext) to the LET statement, in this manner:

=LET(m,MONTH(A1), beg,DATE(YEAR(A1),m,1), grid,SEQUENCE(6,7,beg-WEEKDAY(beg)+1), cal,IF(MONTH(grid)=m,DAY(grid),""), mtext,HSTACK("","","",TEXT(A1,"mmmm yyyy"),"","",""), VSTACK(mtext,{"Sun","Mon","Tue","Wed","Thu","Fri","Sat"},cal))

The mtext variable contains a seven-element array where the center element contains the month and year of whatever date is in cell A1. This is added to the VSTACK function, resulting in the month and year just above the day-of-week column headings.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10053) applies to Microsoft Excel Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Condensing and Expanding Headings

When working in Outline view, you'll undoubtedly have the need to expand or condense information under your headings. It ...

Discover More

Viewing Multiple Pages

If you have a large monitor, you can view more than one page at a time in Word. This is very handy when you want to ...

Discover More

Hiding Gridlines

For those times when you remove the borders from your tables, Word provides a way that you can display non-printing ...

Discover More

Dive Deep into Macros! Make Excel do things you thought were impossible, discover techniques you won't find anywhere else, and create powerful automated reports. Bill Jelen and Tracy Syrstad help you instantly visualize information to make it actionable. You’ll find step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and solutions. Check out Microsoft Excel 2019 VBA and Macros today!

More ExcelTips (ribbon)

Combining Cell Contents

Excel allows you to easily combine text together. Interestingly, it provides two ways you can perform such combinations. ...

Discover More

Deriving Monthly Median Values

When processing huge amounts of data, it can be a challenge to figure out how to derive the aggregate values you need. ...

Discover More

Calculating Statistical Values on Different-Sized Subsets of Data

Discovering different ways to analyze your data can be a challenge. Here's how to work with arbitrary subsets of a large ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 1?

2025-12-20 14:04:23

J. Woolley

Re. my previous comment below, I forgot to add the following link: https://sites.google.com/view/MyExcelToolbox


2025-12-20 11:16:52

J. Woolley

My Excel Toolbox includes the following function to create a calendar that starts with a given month and year and contains any number of months:
    =ListCalendar([YearNum], [MonthNum], [NumMonths], [SkipHeader],
            [FirstDayOfWeek])
The default value for FirstDayOfWeek is 1 (Sunday). Here is the result of the following formula:
    =ListCalendar( , , 2, , 2)
(see Figure 1 below)

Figure 1. 


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.