Convert date to day name
To convert a date into a day name you can apply the Excel TEXT function
Example: Convert date to day name
=TEXT(B5,C5)
|
The formula uses the Excel TEXT function to convert the date (15/03/2017) in cell (B5) to a day name in the "dddd" format, which is referenced to in cell (C5). If you are entering the day format directly into the formula you will need to include the double quotation marks (e.g. TEXT(B5,"dddd")).
|
Sub Convert_date_to_day_name()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to convert date to day 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 day name is captured in cell ("B5").
Day Format Range: Ensure that the day 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 day name is captured in cell ("B5").
Day Format Range: Ensure that the day 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 day name by changing the cell reference ("B5") to any range in the worksheet, that doesn't conflict with the formula.
Day Format Range: Select the day 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.
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 day name by changing the cell reference ("B5") to any range in the worksheet, that doesn't conflict with the formula.
Day Format Range: Select the day 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 day 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 day name in the "dddd" format. If you are entering the day format directly into the formula you will need to include the double quotation marks (e.g. TEXT(B5,"dddd")).
To convert a date into a day 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 day name in the "dddd" format. If you are entering the day format directly into the formula you will need to include the double quotation marks (e.g. TEXT(B5,"dddd")).
FORMULA
=TEXT(date, "dddd")
=TEXT(date, "dddd")
ARGUMENTS
date: A numeric value to to convert to a specified day format.
"dddd": The day format that will be applied against the selected date.