Date sorting issue

DJFANDANGO

Board Regular
Joined
Mar 31, 2016
Messages
112
Office Version
  1. 365
Platform
  1. Windows
Recently our systems were updated, we used to have DD/MM/YYYY now they have are MM/DD/YYYY format, now my data is horrendously messed up...

I've tried Data>Text to Columns>Delimiter etc... but it's not able to convert all the dates, the old data has been converted, but I'm left with 'dates' and 'text' in my date ranges....?

My computer is set to DD/MM/YYYY

Below you can see how the data is represented on my system, on the 'Reference Id' its displayed as 'YY/MM-number of...' I'm not sure if tis can be used as a 'reference' to fix the date issue with a macro/vba?

Thanks in advance.

GASafetyObservation637371481765547378.xls
AB
1Reference IdObservation Date
2-18/08-4768/31/2018
3-18/08-4778/31/2018
4-19/02-4032/22/2019
5-18/07-0687/30/2018
6-18/12-91412/09/2018
7-18/12-93412/11/2018
8-19/01-0491/13/2019
9-19/01-1471/21/2019
Sheet1
 
A column reference not required. B column data can be changed todd/mm/yyyy format

VBA Code:
=TEXT(IF(ISTEXT( B2),DATE(RIGHT(B2,4),LEFT(B2,FIND("/",B2)-1),MID(B2,FIND("/",B2)+1,2)),DATE(YEAR(B2),DAY(B2),MONTH(B2))),"dd/mm/yyyy")
It should be pointed out that will return a Text value, not a Date one. You just need to be aware of that in case you want to perform sorting or calculations on it.
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
It should be pointed out that will return a Text value, not a Date one. You just need to be aware of that in case you want to perform sorting or calculations on it.
I have tested that it will be in date format in the cell. If the problem is there you can use this formula and Format the cell for date as dd/mm/yyyy.

=IF(ISTEXT( B2),DATE(RIGHT(B2,4),LEFT(B2,FIND("/",B2)-1),MID(B2,FIND("/",B2)+1,2)),DATE(YEAR(B2),DAY(B2),MONTH(B2)))
 
Upvote 0
I have tested that it will be in date format in the cell. If the problem is there you can use this formula and Format the cell for date as dd/mm/yyyy.
Yes, by removing the TEXT function that you had on there originally, it can now return a Date value.
The TEXT function will always return a Text value.
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
Members
448,961
Latest member
nzskater

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