Reputation: 3
I have dates in the format:
Monday, March 25 2019
Wednesday, September 25 2019
I would like to convert them to DD/MM/YY format (i.e 25/03/2019)
I have tried the following excel formula:
DATEVALUE(MID(B2,FIND(", ",B2)+6,2)&"-"&MID(B2,FIND(", ",B2)+2,3)&"-"&RIGHT(B2,4))
does anyone know where I have made an error in this formula or an alternative?
Upvotes: 0
Views: 56
Reputation: 2309
The way you find your day is incorrect, you search for ", "
which is the only unique character in string, but then add 6 to that to get your date value (25) this won't work because the month names can be longer. This formula will work:
=DATEVALUE(LEFT(RIGHT(B2,7),2)&"-"&MID(B2,FIND(", ",B2)+2,3)&"-"&RIGHT(B2,4))
It takes the last 7 characters from the string (day and year, always same size assuming a leading zero in the date) and gets the first two numbers from it, matching your day.
EDIT Tested without a leading zero in the date, this seems to work as well.
Upvotes: 1