Month for the Nth Sunday

Written by Allen Wyatt (last updated November 25, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

Ernest needs either a formula or a macro to first determine the Nth Sunday of the year (let's say the 23rd Sunday of the year) and then return the name of the month in which that Sunday occurs. He's at a loss as to how such a formula or macro would be constructed.

This task could be accomplished with a macro, but it is very easy to accomplish with a formula, so we'll go with that route. Since Excel uses serial numbers for dates, it makes it very easy to do the math necessary to figure out such things as the Nth Sunday.

The trick to figuring out the proper formula is to figure out the last Sunday of the previous year. (Yes, the last Sunday.) This can be done in any number of ways, but here is a good method, assuming that the four-digit year you want is stored in cell A1:

=DATE(A1,1,1)-WEEKDAY(DATE(A1,1,1)-1)

This works because the WEEKDAY function, by default, returns a value of 1 through 7 (Sunday through Saturday). Let's say, for instance, that the year in A1 is 2019. This means that WEEKDAY will return the value 3 for January 1, 2019, meaning that it falls on a Tuesday. Subtract 1 from that, giving you 2, which you then subtract from the actual date for January 1. The result is the date of the last Sunday in 2018, which is December 30.

With that date in hand, all you need to do is to multiply the number of the Sunday desired (let's say that is in cell B1) by 7. Add it to the date calculated above, and you have the date of the Nth Sunday in the desired year:

=(DATE(A1,1,1)-WEEKDAY(DATE(A1,1,1)-1))+(B1*7)

At this point you have two options. One is that you can apply a custom format to the cell in which the above formula is located. Using a custom format of "mmmm" will show the result as a full month name. I tend to prefer the alternative option, which is to wrap the entire formula in the TEXT function, in this manner:

=TEXT((DATE(A1,1,1)-WEEKDAY(DATE(A1,1,1)-1))+(B1*7), "mmmm")

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (1564) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

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

Inserting a Cross-Reference to Text

Cross-referencing is a great feature of Word that allows you to add references to text in various places of your ...

Discover More

Running Out of Memory

Do you get an error when you try to insert just one more chart in your workbook? It could be because of an obscure ...

Discover More

Editing a Document with Many Pages

Working with large or long documents in Word can present some interesting challenges. The most common challenge is that ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Calculating Dates for Thanksgiving

Ever wonder how to calculate the date for Thanksgiving in the United States? In this tip you discover not only that, but ...

Discover More

Unique Military Date Format

Some industries (such as the military) have special formatting that they use to represent dates. Here is one such format ...

Discover More

Changing How Excel Determines which Year to Use

When you enter a date into a cell and you omit the year, Excel helpfully adds the current year to the date. If you want ...

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 5 + 3?

2023-11-27 10:48:48

J. Woolley

My Excel Toolbox includes the following function to return the date of the Nth weekday of a month for a year:
    =NthWeekdayOfMonth(NthNbr, DayNbr, MonthNbr, YearNbr)
For the Tip's example (23rd Sunday of 2019) set NthNbr=23, DayNbr=1 (Sunday), MonthNbr=1 (count from the beginning of the year), and YearNbr=2019 (must be greater than 1899). So with A1=2019 and B1=23, this formula returns the month (June):
    =TEXT(NthWeekdayOfMonth(B1,1,1,A1),"mmmm")
See https://sites.google.com/view/MyExcelToolbox/


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.