Convert date to month name
To convert a date into a month name you can apply the Excel TEXT function
Example: Convert date to month name
=TEXT(B5,C5)
|
The formula uses the Excel TEXT function to convert the date (15/03/2017) in cell (B5) to a month name in the "mmmm" format, which is referenced to in cell (C5). If you are entering the month format directly into the formula you will need to include the double quotation marks (e.g. TEXT(B5,"mmmm")).
|
Sub Convert_date_to_month_name()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to convert date to month name
ws.Range("D5") = Application.WorksheetFunction.Text(ws.Range("B5"), ws.Range("C5"))
ws.Range("D5") = Application.WorksheetFunction.Text(ws.Range("B5"), ws.Range("C5"))
End Sub
OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named Analyst.
Date Range: Ensure that the date you want to convert to a month name is captured in cell ("B5").
Month Format Range: Ensure that the month format that you want to convert date to is captured in cell ("C5").
Worksheet Name: Have a worksheet named Analyst.
Date Range: Ensure that the date you want to convert to a month name is captured in cell ("B5").
Month Format Range: Ensure that the month format that you want to convert date to is captured in cell ("C5").
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
Date Range: Select the date that you want to convert to a month name by changing the cell reference ("B5") to any range in the worksheet, that doesn't conflict with the formula.
Month Format Range: Select the month format that you want to convert date to by changing the cell reference ("C5") to any range in the worksheet, that doesn't conflict with the formula.
EXPLANATION
To convert a date into a month name you can apply the Excel TEXT function. In this example the Excel TEXT function converts the date (15/03/2017) in cell (B5) to a month name in the "mmmm" format. If you are entering the month format directly into the formula you will need to include the double quotation marks (e.g. TEXT(B5,"mmmm")).
To convert a date into a month name you can apply the Excel TEXT function. In this example the Excel TEXT function converts the date (15/03/2017) in cell (B5) to a month name in the "mmmm" format. If you are entering the month format directly into the formula you will need to include the double quotation marks (e.g. TEXT(B5,"mmmm")).
FORMULA
=TEXT(date, "mmmm")
=TEXT(date, "mmmm")
ARGUMENTS
date: A numeric value to to convert to a specified month format.
"mmmm": The month format that will be applied against the selected date.