date format by formula help

orsm6

Well-known Member
Joined
Oct 3, 2012
Messages
515
Office Version
  1. 365
Platform
  1. Windows
Hi all - recently got help to take AU date format in one cell and convert it to US date format by formula in the cell to right. It worked fine, but now we are further along in the month something weird is happening.

you can see from the image uploaded that:
- 12/02/2024 converts fine to 2/12/2024......

- but 13/02/2024 is converting to 2/1/2025??? where it should be 2/13/2024

this is the formula =LET(sDt,TEXT(A41,"dd/mm/yyyy"),aDt,TEXTSPLIT(sDt,"/"),DATE(INDEX(aDt,,3),INDEX(aDt,,1),INDEX(aDt,,2)))

where am i going wrong?
TIA
 

Attachments

  • 1707780847272.png
    1707780847272.png
    2.7 KB · Views: 13

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I suspect it is because it thinks there is a 13th month in the formula so it is erroring out somehow.

i am using the converted date to do a lookup into a table of data where the dates in the table have been unfortunately formatted differently to AU
 
Upvote 0
I think that i need to convert the format, but then store the value as text?
 
Upvote 0
i tried using =TEXT(A41,"m/dd/yy")

it works for any date that is 13/mm/yy and up... but for any value that is less it converts it to an actual date and my lookup won't work.
 
Upvote 0
TEXT will not return an actual date. If the values in column A are actual dates, then a lookup should work regardless of format, unless the values in the lookup table are stored as text?
 
Upvote 0
TEXT will not return an actual date. If the values in column A are actual dates, then a lookup should work regardless of format, unless the values in the lookup table are stored as text?
yeah - as a work around I have done this... =IF(DAY(A41)<=12,LET(sDt,TEXT(A41,"dd/mm/yyyy"),aDt,TEXTSPLIT(sDt,"/"),DATE(INDEX(aDt,,3),INDEX(aDt,,1),INDEX(aDt,,2))),TEXT(A41,"m/dd/yy")) so that if it is recognised as a date it will get the right format, but if not a date it will place text string in a format i need it in.

i did it like this.. because the source data can be both date and text.
 
Upvote 0
How does the source data get into the worksheet?
 
Upvote 0
How does the source data get into the worksheet?
the data is downloaded from a web based portal as a csv. the values are copied out of the csv and paste into the final dest sheet.
the formula then interrogates the data
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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