Change date format on import

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,046
Office Version
2010
Platform
Windows
note in this string =DATE(RIGHT(B5,4),MONTH(1&LEFT(B5,3)),MID(B5,5,1)) there is no refernce to the data in cell B6 which holds the calendar year?
"
The following suggestion looks the same as your example; the data is in merged cells.

That formula was a guess. One possibility was that you were using merged cells.
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

namloop

New Member
Joined
Mar 23, 2020
Messages
23
Office Version
365
Platform
Windows
No the cells are separate when they import - Jan2 in one cell 2022 in the cell below.
Thanks
Stephen
 

mamady

Board Regular
Joined
Sep 23, 2011
Messages
75
Office Version
365
Platform
Windows
Hi Dave

This sheet is imported from an online timetable.
The data in row B says general.
My Windows settings (Australia) is day month year.
The required format will be dd-mmm-yy in the sheet

I did enter your two =text strings into C13 c&d and got a #VALUE! response

I attempted to attach the spreadsheet but realised the forum doesn't allow this.

Thanks again
Stephen
Hi Stephen,

You can upload the sample sheet on cloud storage like google drive or dropbox and share with us the download link.

Best Regards
M. Yusuf
 

namloop

New Member
Joined
Mar 23, 2020
Messages
23
Office Version
365
Platform
Windows
M.Yusuf and Dave

I have placed the test file in the dropbox and highlighted the cells I am trying to acheive dd-mmm-yy


Many thanks
Stephen
 

mamady

Board Regular
Joined
Sep 23, 2011
Messages
75
Office Version
365
Platform
Windows
Hi Stephen,

This issue is that there is a space after 2021 is cell b13
please use the below slightly modified formula

=TEXT(DATE(LEFT(B13,4),MONTH(DATEVALUE(LEFT(B12,3)&" 1, 2020")),MID(B12,5,1)),"dd-mmm-yy")

Regards
M. Yusuf
 

namloop

New Member
Joined
Mar 23, 2020
Messages
23
Office Version
365
Platform
Windows
Hi Mamady
I have resaved the file to show I have pasted the string into the adjacent cell.
I am getting the #VALUE! error message.

With thanks
Stephen
 

mamady

Board Regular
Joined
Sep 23, 2011
Messages
75
Office Version
365
Platform
Windows
Hi Stephen,

Not sure why you are still getting error. But you can find the file with the same formula in the following link without any error


Regards
M. Yusuf
 

namloop

New Member
Joined
Mar 23, 2020
Messages
23
Office Version
365
Platform
Windows
Many thanks I can now see that - I will investigate my end to see why this has caused such a problem - I thank you and all that have assisted.
Regards
Stephen
 

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,046
Office Version
2010
Platform
Windows
There is an extraneous character in cell B13.
Try =Len(B13) the result is 5!!

Try this formula

=DATE(LEFT(B13,4),MONTH(1&LEFT(B12,3)),MID(B12,5,1))

Then format the cell to your preference.

If all of the dates are 2021, the following would work
=DATE(2021,MONTH(1&LEFT(B12,3)),MID(B12,5,1))
 
Last edited:

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,046
Office Version
2010
Platform
Windows
The check for extraneous characters would have shown which cell has the problem.
Excel's Formula Evaluation showed the contents of B13 had a space at the end "2013 ".

=DATE(LEFT(B13,4),MONTH(LEFT(B12,3)&1),MID(B12,5,1)) also works.

Unless you need the cell to be Text, do not convert to text; just format or custom format to your preference.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,100,037
Messages
5,472,115
Members
406,804
Latest member
xbinsx

This Week's Hot Topics

Top