Unified DDMMYY with variable data

razor_raef

New Member
Joined
Sep 15, 2019
Messages
19
Hi team,

I'm trying to create a unified formula to give DDMMYY outcome with variable data.

In column A, dates have been pulled from a program which give the formats as attached. Unfortunately the dates are never constant as you can see and trying to create a formula isn't working for me (e.g =TEXT(A1,"DD/MM/YY").

Can anyone please help me in figuring out a simple formula to pull DDMMYY from the variable data?

Thank you in advance

Dates.xlsx
A
18/3/24
28/3/24
38/3/24 12:00
49/3/24
59/3/24 12:00
69/3/24 12:00
710/3/24
810/3/24 12:00
910/3/24 12:00
1011/3/24
1111/3/24 12:00
1211/3/24 12:00
1312/3/24
1412/3/24 12:00
1512/3/24 12:00
1613/03/2024 12:00:00 PM
1714/03/2024 12:00:00 PM
1815/03/2024 12:00:00 PM
1915/03/2024 12:00:00 PM
2017/03/2024 12:00:00 PM
Sheet1
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Really weird, I just posted that with XL2BB and it shows in correct format however the original data ACTUALLY looks like this:

Screenshot 2024-03-03 at 2.16.18 pm.png


As you can see with the original way it's formatted above, some cells are M/DD/YYYY, others are DD/MM/YYYY, some are M/DD/YY.

I need if possible please Column B to have the formula that produces DD/MM/YY.
 
Upvote 0
That seems to indicate that your default system setting for date is m/dd/yyyy is that the case ? In which case why do you want it as dd/mm/yyyy
Does the spreadsheet come to you from somewhere else or is it a spreadsheet you created ?
 
Upvote 0
That seems to indicate that your default system setting for date is m/dd/yyyy is that the case ? In which case why do you want it as dd/mm/yyyy
Does the spreadsheet come to you from somewhere else or is it a spreadsheet you created ?
The default system that i'm retrieving the information from I don't have accessibilty to checking the date format settings when the report is ran however from the screenshot shown on the actual data cells, it appears some are in MM/DD/YYYY, others are DD/MM/YYYY TIME, MM/DD/YYYY TIME so i'm going to presume my date/time values are going to be completely randomized.

I require to export the information in Column A into Column B as DD/MM/YY for the next part of the reporting run.

The raw data is given to me from a system I only have access to hitting "run report" and it gives me an excel dump of all the information. Every other field is fine but this Column of randomized dates that I can't get to simply show as DD/MM/YY by changing formats because of the different values dumped from the system. I figured if I can copy this Column into a new spreadsheet, run a formula to Column B and export that info back into the original data dump then i'll be fine to go from there.
 
Upvote 0
If the initial report is creating an Excel in that same sheet can you go into any cell and type =TODAY()-7 and show me what you see.
Then in a new workbook do the same thing.
Does the system generated workbook return mm/dd/yyyy and the new workbook dd/mm/yyyy ?
If that is the case what happens if you copy from the system generated workbook to the New Workbook using Paste Values ?

By the way: what version of Excel are you using. Can you update your Account Profile ?
 
Last edited:
Upvote 0
Both show the date as DD/MM/YYYY when entering =TODAY()-7.

Microsoft Excel for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20882) 32-Bit, yes can click into an account profile.
 
Upvote 0
Your results look a bit odd to me and I am have some concerns on whether it will refresh in a consistent manner.
Based on what you have at the moment and assuming your data starts in A2, give this a try.
Excel Formula:
=LET(sDate,IF(ISNUMBER(A2),TEXT(A2,"mm/dd/yyyy"),A2),
DATEVALUE(sDate))
 
Upvote 0
What version of Excel are you using ? Can you please update your profile on the Forum to show what version you are using since the answer will vary depending on the version.
Try this without using "LET"
Excel Formula:
=DATEVALUE(IF(ISNUMBER(A2),TEXT(A2,"mm/dd/yyyy"),A2))
 
Upvote 1
@razor_raef
How about using vba?
VBA Code:
Sub flipDate()
Dim x, tx As String
Dim r As Range, va
va = Range("A1", Cells(Rows.Count, "A").End(xlUp))
For Each r In Range("A1", Cells(Rows.Count, "A").End(xlUp))
    tx = Split(r.Text, " ")(0)
    x = Split(tx, "/")
    i = i + 1
    If UBound(x) = 2 Then
        If CLng(x(0)) < 13 Then
            va(i, 1) = DateSerial(x(2), x(0), x(1))
        Else
            va(i, 1) = DateValue(r.Text)
        End If
    Else
        va(i, 1) = Empty
    End If
Next
Range("B1").Resize(UBound(va, 1), 1) = va

End Sub

Book1
AB
103/08/202408/03/2024
203/08/202408/03/2024
303/08/2024 12:0008/03/2024
403/09/202409/03/2024
503/09/2024 12:0009/03/2024
603/09/2024 12:0009/03/2024
703/10/202410/03/2024
803/10/2024 12:0010/03/2024
903/10/2024 12:0010/03/2024
1003/11/202411/03/2024
1103/11/2024 12:0011/03/2024
1203/11/2024 12:0011/03/2024
1303/12/202412/03/2024
1403/12/2024 12:0012/03/2024
1503/12/2024 12:0012/03/2024
1613/03/2024 12:0013/03/2024
1714/03/2024 12:0014/03/2024
1815/03/2024 12:0015/03/2024
1915/03/2024 12:0015/03/2024
2017/03/2024 12:0017/03/2024
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top