Convert number in ddmmyyyy order to date

To convert number in ddmmyyyy order to date you need to apply a combination of the Excel DATE, RIGHT, MID and LEFT functions

Example: Convert number in ddmmyyyy order to date

Convert number in ddmmyyyy format to date

METHOD 1. Convert number in ddmmyyyy order to date

EXCEL

=DATE(RIGHT(B5,4),MID(B5,3,2),LEFT(B5,2))
The formula uses the Excel DATE function to convert the year, month and day to a date. The year, month and day are sourced from the selected number and are split up by year, month and day through the use of the RIGHT, MID and LEFT Excel functions.

METHOD 1. Convert number in ddmmyyyy order to date using VBA

VBA

Sub Convert_number_in_ddmmyyyy_order_to_date()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to convert the number in cell ("B5"), which is represented in ddmmyyyy order to date
ws.Range("E5") = DateSerial(Right(ws.Range("B5"), 4), Mid(ws.Range("B5"), 3, 2), Left(ws.Range("B5"), 2))

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.
PREREQUISITES
Worksheet Name: Have a worksheet named Analyst.
Number to convert to Date: Ensure that the number that you want to convert to date is captured in cell ("B5") and is in the ddmmyyyy order.
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("E5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
Number to convert to Date: Select the number that you want to convert to date by changing the cell reference ("B5") to any cell in the worksheet that contains the number that you want to convert to date and doesn't conflict with the formula.

Explanation about the formula used to convert number in ddmmyyyy order to date

EXPLANATION

EXPLANATION
To convert number in ddmmyyyy order to date you need to apply a combination of the Excel DATE, RIGHT, MID and LEFT functions.
FORMULA
=DATE(RIGHT(number,4),MID(number,3,2),LEFT(number,2))

ARGUMENTS
number: A numeric value in ddmmyyyy order to to convert to a date format.