Convert imported text string to date format

The date field from a imported csv is dMmmYYYY (i.e. 31Dec2017). I’ve tried text to columns and recombining with the =date and =month formulas to no avail. Please help!

I used VLOOKUP to convert the Mmm to number and then =date to combine to date again. A bit cumbersome and I’m convinced there must be an easier method.

I know that the formula is very long and difficult to understand

=IFERROR(IFERROR(DATE(VALUE(RIGHT(E1;4));HLOOKUP(MID(E1;3;3);{"Apr";"Aug";"Dec";"Feb";"Jan";"Jul";"Jun";"Mar";"May";"Nov";"Oct";"Sep"|4;8;12;2;1;7;6;3;5;11;10;9};2;1);VALUE(LEFT(E1;2)));DATE(VALUE(RIGHT(E1;4));HLOOKUP(MID(E1;2;3);{"Apr";"Aug";"Dec";"Feb";"Jan";"Jul";"Jun";"Mar";"May";"Nov";"Oct";"Sep"|4;8;12;2;1;7;6;3;5;11;10;9};2;1);VALUE(LEFT(E1;1))));"Wrong date")

However, it seems to do the right thing

When you open the csv file, try checking the option Detect special numbers

If this answer helped you, please accept it by clicking the check mark :heavy_check_mark: to the left and, karma permitting, upvote it. If this resolves your problem, close the question, that will help other people with the same question.

Hello @Brewmaster,

i think these values were imported as String rather than Date.

Here’s how to make them into dates, using 2 helper columns ( here G and H ):

( column B is the column with the imported date strings, just enter the following formula into cell G1, then drag down):

=LEFT(B1;LEN(B1)-7)&" "&MID(B1;LEN(B1)-6;3)&" "&RIGHT(B1;4)

then enter the following formula into cell H1, and drag down:

=DATE(YEAR(G1);MONTH(G1);DAY(G1))

Now the values in column G are interpreted as dates instead of strings.