Skip to main content

3 easy methods to convert month name to number in Excel

Author: Sun Last Modified: 2024-07-17

In Excel, there are times when you need to convert month names to their corresponding numbers to facilitate data analysis and processing. This tutorial will cover three methods to convert month names to numbers: using a formula, using Kutools for Excel, and using VBA code. Whether you are a beginner or an experienced Excel user, these methods will help you enhance your productivity.

doc month name to number 1


Convert month name to number in Excel

This section covers three methods to convert month names to numbers: using a formula, using Kutools for Excel, and using VBA code. Each method is tailored to cater to different user preferences and technical capabilities, ensuring flexibility and ease of use across various Excel scenarios.

Use formula to convert month name to number in Excel

Using a formula is a simple and flexible way to convert month names to numbers. Excel's built-in formula functions are powerful, allowing us to create a formula that automatically converts month names. Let's walk through the steps to achieve this.

Type the following formula into a blank cell, and press the Enter key. Select this formula cell and drag its Fill Handle down to get the rest of the results.

=MONTH(A2&1)

doc month name to number 2

Easily convert date to corresponding month number with Kutools

If you want to convert an entire date to its corresponding month name and prefer a simpler approach, Kutools for Excel is a highly useful tool. It's Apply Date Formatting features can simplify your workflow. Here are the steps to convert dates to corresponding month numbers using Kutools for Excel.

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

  1. Select the dates you want to convert to month number, then select Kutools > Format > Apply Date Formatting.
  2. In the popped out Apply Date Formatting dialog box, choose the 03 option in the Date format list, and then click OK.
    You can preview the results in real time in the Preview pane.
    doc apply date formatting 2
Result

All dates in the selected range have been converted to corresponding month names immediately.

doc apply date formatting 3

Note: To use this feature, you should have Kutools for Excel installed on your computer. Go to download Kutools for Excel to get a 30-day free trial with no limitations.

Use VBA code to convert month name to number in Excel

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 code: 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.


Convert date to month number or month name or other date formats


Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
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...

Description


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
There are no comments posted here yet
Load More
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations