Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Macro for Month Name.

Macro for Month Name

Written by Allen Wyatt (last updated September 19, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


1

Brian is looking for a macro that returns the full name of the current month, such as July, August, etc. Before getting to the macros, it should be mentioned that depending on your needs, you can get the desired information with one of several formulas. Perhaps the easiest formula is the following:

=Today()

Place the formula into a cell, and you end up with today's date. Format the cell using a custom format, and you end up with the full month name. The custom format is applied by using these steps:

  1. Select the cell containing the formula.
  2. Choose Cells from the Format menu. Excel displays the Format Cells dialog box.
  3. Make sure the Number tab is displayed.
  4. In the list of format categories, select Custom. (See Figure 1.)
  5. Figure 1. The Number tab of the Format Cells dialog box.

  6. In the Type box, enter mmmm.
  7. Click OK.

Another formulaic approach is to use the following in a cell:

=Text(Today(),"mmmm")

No special formatting is required; the formula returns the text of the full month name for whatever today is. Finally, you could use an even longer formula that simply picks the month name from a list of months:

=CHOOSE(MONTH(NOW()),"January","February",
"March","April","May","June","July",
"August","September","October","November",
"December")

Remember that this is a single formula; it goes all in one cell.

Which brings us, finally, to the macros. If you want a macro that returns the month name in the current cell, you are looking for a user-defined function:

Function MonthName()
    Application.Volatile
    MonthName = Format(Date, "mmmm")
End Function

This simple two-line macro dynamically returns the month name for whatever the current date is. Just put this formula in a cell:

=MonthName()

Remember—since you've just added a macro to your workbook, you'll be asked whenever you open your workbook if you want to enable macros. If you don't want to see this question all the time, you should use one of the formulaic approaches presented earlier.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2915) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Macro for Month Name.

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

Replacing Text Selections

When editing a document, Word normally replaces whatever text you select with whatever you start to type. Here's how to ...

Discover More

Navigating In the Document Map

Using the Document Map to navigate through your document is easy and intuitive. The value of using it for navigation is ...

Discover More

Generating a Font Sample Sheet

You can have quite a few fonts installed on your system, each of them managed by Windows. If you would like a document ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (menu)

Displaying Negative Times

Excel allows you to perform math using times as operands. If you subtract a later time from an earlier time, you should ...

Discover More

How Excel Stores Dates and Times

Excel stores dates and times internally using what is called a serial number. This tip explains how that serial number is ...

Discover More

Leap Years and Fiscal Periods

Need to figure out when a fiscal year ends when that period does not correspond to the calendar year? Here are some ways ...

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 four minus 0?

2020-09-19 11:43:16

Rick Rothstein

For those who might find this interesting, there is a simple way to get the Month name from the month number in both VBA and via Excel formula.

In VBA this is dirt simple as there is a function for it... MonthName (figures, right?). Simply pass the number in and the function returns the full name. There is an optional Boolean argument that when set to True returns the abbreviated month name instead.

Now for the Excel formula (cell A1 is assumed to contain a number between 1 and 12)...

=TEXT(28*A1,"mmmm")

You can also use 29 in place of the 28 and it will still work. Both of those numbers will work correctly in the 1904 date system as well. If you never work in the 1904 date system, you can also use 30 in place of the 28 and that will also work.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.