Skip to main content

How to convert month name to number in Excel?

Sometimes, you may want to convert the month name to number or the number to month name, such as convert January to 1, in Excel, you can use formulas and VBA to quickly convert between month name and number.
doc month name to number 1

Convert month name to number in Excel

Convert number to month name with VBA

Convert date to month name or month number with Kutools for Excel good idea3


arrow blue right bubble Convert month name to number in Excel

There are two ways that can help you to convert month names to numbers in Excel.

Method 1: Convert month name to number with formula.

Type this formula =MONTH(DATEVALUE(A1&" 1")) ( A1 indicates the cell that you want to convert the month name to number, you can change it as you need) into a blank cell, and press Enter key. See screenshot:
doc month name to number 2

If you want to convert a column list of month names to numbers, just drag the fill handle of the formula cell to fill the range you need. See screenshot:
doc month name to number 3

Method 2: Convert month name to number with VBA

1. Hold ALT button and press F11 on the keyboard to open a Microsoft Visual Basic for Application window.

2. Click Insert > Module, and copy the VBA into the module.

VBA: Convert month name to number

Sub ChangeNum()
'Updateby20140311
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    If Rng.Value <> "" Then
        Rng.Value = Month(DateValue("03/" & Rng.Value & "/2014"))
    End If
Next
End Sub

3. Click Run to run the VBA code, and a KutoolsforExcel dialog pops up for you to select a range of cells with month names that you want to convert to numbers, then click OK, the selecetd month names have been converted to month numbers. See screenshot:
doc month name to number 4

Tip: Using the above VBA may lose your original data, you can save them before you running the VBA code.

Quickly and easily convert date to other date formatting in Excel

Have you ever tried to convert a date to day, month or year only? The formulas maybe hard to remember, but the Apply Date Formatting of Kutools for Excel can quickly convert a standard date to the date formatting as you need as below screenshot shown. Dont, waite, click for 30 days free trial!
doc apply date format
 
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

arrow blue right bubble Convert number to month name with VBA

In reverse, if you want to convert numbers to month names, you also can use two methods to solve it.

Method 1: Convert number to month name with formula.

Type this formula =TEXT(DATE(2000,A1,1),"mmmm") ( A1 indicates the cell that you want to convert the number to month name, you can change it as you need) into a blank cell, and press Enter key. See screenshot:
doc month name to number 5

If you want to convert a column list of numbers to month names, just drag the fill handle of the formula cell to fill the range you need. See screenshot:
doc month name to number 6

Tip: If you want to convert number to the abbreviation of the month name, you can use this formula =TEXT(DATE(2000,A1,1),"mmm").
doc month name to number 7

Method 2: Convert number to month name with VBA

1. Hold ALT button and press F11 on the keyboard to open a Microsoft Visual Basic for Application window.

2. Click Insert > Module, and copy the VBA into the module.

VBA: Convert number to month name

Sub ChangeMonth()
'Updateby20140311
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    Rng.Value = VBA.Format(Rng.Value * 29, "mmmm")
Next
End Sub

3. Click Run to run the VBA code, and a KutoolsforExcel dialog pops up for you to select a range of cells with numbers you want to convert to the month names. Then click OK, the numbers have been converted to corresponding month names. See screenshot:
doc month name to number 8

Tip:

1. Using the above VBA may lose your original data, you can save them before you running the VBA code.

2. If you want to convert number to the abbreviation of the month name, you can change "mmmm" to "mmm" in the above VBA.


arrow blue right bubble Convert date to month name or month number with Kutools for Excel

If you have a list of dates in a worksheet needed to convert to month name or month number, in this case, you can apply Kutools for Excel’s Apply Date Formatting utility.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After free installing Kutools for Excel, please do as below:

1. Select the dates and click Kutools > Format > Apply Date Formatting. See screenshot:
doc apply date formatting 1

2. Then in the popped out dialog, select the date format you need from the Date formatting list, and you can see the result from the Preview pane.
doc apply date formatting 2

3. Then click Ok or Apply, you can see the dates have been converted to relative month names or month numbers.
doc apply date formatting 3

Click here to know more about Apply Date Formatting

arrow blue right bubble Convert date to month number or month name or other date formats


Quickly convert nonstandard date to standard date formattiing(mm/dd/yyyy)

In some times, you may received a workhseets with multiple nonstandard dates, and to convert all of them to the standard date formatting as mm/dd/yyyy maybe troublesome for you. Here Kutools for Excel's Conver to Date can quickly convert these nonstandard dates to the standard date formatting with one click.  Click for free full featured trial in 30 days!
doc convert date
 
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

Best Office Productivity Tools

Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

kte tab 201905


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Cute solution, using datevalue. Took me a minute to figure it out. "Jan" is a random piece of text. The "&1" turns it into "Jan 1," which is a date upon which datevalue can do it's magic. Clever solution. :)
This comment was minimized by the moderator on the site
DATEVALUE wouldn't work with most of the local date formats.
This comment was minimized by the moderator on the site
wf = one week from now mf= one month from the entry 2mf= 2 months from the entry 4mf= 4 months from the entry 6mf= 6 months from the entry yf= one year from the entry I am wondering if possible to covert this entry in another column as due dates.
This comment was minimized by the moderator on the site
If you pre-filling the month names, did you try using a vlookup instead of using a VBA?
This comment was minimized by the moderator on the site
Thank you It works in my case
This comment was minimized by the moderator on the site
This is funny. Following Function converts the Filename which is Month Name to its corresponding Numerical value =MONTH(1&LEFT((MID(CELL("filename",A1),SEARCH("[",CELL("filename",A1))+1,SEARCH(".",CELL("filename",A1))-1-SEARCH("[",CELL("filename",A1)))),3))
This comment was minimized by the moderator on the site
Excel function MONTH: does it get the number from text for example from NOV it would get 11, or: the text from the number for example from 11 it would get NOV, or what? On my location it goes from 11 to 11, not very interesting!!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations