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

Discovering the RGB Value of a Custom Text Color

Word allows you to easily change the color of the text in your document. If you get a document from someone else, you may ...

Discover More

Merging Table Cells

Want to create cells that span multiple columns or multiple rows? You do this in Word by merging cells together. Here's ...

Discover More

Changing Colors of Spelling and Grammar Underlines

The red and green wavy underlines used in Word can be a boon for proofing a document, but they are of little use if you ...

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)

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

Finding the Previous Work Day

Excel has a number of functions that are available as an add-on in the Analysis ToolPak. One of these functions allows ...

Discover More

Converting an Unsupported Date Format

Excel makes it easy to import information created in other programs. Converting the imported data into something you can ...

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 nine minus 7?

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.