Excel 2010 - change US dates to UK format
I have imported a CSV file with 2 long columns of dates. These dates are in the US format Aug/28/2013 and I want them to be in the standard UK dd/mm/yyyy format.
I have tried formatting the cells as US dates and then converting them to number-only formats, and various other permutations within the Date format box, but with no success.
Can anyone rid me of these awful US dates please?
excel date-format
add a comment |
I have imported a CSV file with 2 long columns of dates. These dates are in the US format Aug/28/2013 and I want them to be in the standard UK dd/mm/yyyy format.
I have tried formatting the cells as US dates and then converting them to number-only formats, and various other permutations within the Date format box, but with no success.
Can anyone rid me of these awful US dates please?
excel date-format
You can filter the csv before importing in Excel with Powershell on Windows of (after ftp to *nix server) ksh/bash on *nix.
– Walter A
Dec 5 '14 at 10:33
add a comment |
I have imported a CSV file with 2 long columns of dates. These dates are in the US format Aug/28/2013 and I want them to be in the standard UK dd/mm/yyyy format.
I have tried formatting the cells as US dates and then converting them to number-only formats, and various other permutations within the Date format box, but with no success.
Can anyone rid me of these awful US dates please?
excel date-format
I have imported a CSV file with 2 long columns of dates. These dates are in the US format Aug/28/2013 and I want them to be in the standard UK dd/mm/yyyy format.
I have tried formatting the cells as US dates and then converting them to number-only formats, and various other permutations within the Date format box, but with no success.
Can anyone rid me of these awful US dates please?
excel date-format
excel date-format
edited Aug 28 '13 at 12:18
rolve
7,71544164
7,71544164
asked Aug 28 '13 at 11:58
Cara MurphyCara Murphy
44112
44112
You can filter the csv before importing in Excel with Powershell on Windows of (after ftp to *nix server) ksh/bash on *nix.
– Walter A
Dec 5 '14 at 10:33
add a comment |
You can filter the csv before importing in Excel with Powershell on Windows of (after ftp to *nix server) ksh/bash on *nix.
– Walter A
Dec 5 '14 at 10:33
You can filter the csv before importing in Excel with Powershell on Windows of (after ftp to *nix server) ksh/bash on *nix.
– Walter A
Dec 5 '14 at 10:33
You can filter the csv before importing in Excel with Powershell on Windows of (after ftp to *nix server) ksh/bash on *nix.
– Walter A
Dec 5 '14 at 10:33
add a comment |
9 Answers
9
active
oldest
votes
Another solution without using a formula:
- Select the relevant columns
- Choose Data → Text to Columns…
- Select “Delimited” and click Next
- Untick all delimiters and click Next
- Select data column format “Date: MDY” and click Finish
The dates should now be converted to UK dates.
2
Am I the only one for whom this technique literally does nothing?
– cbp
Aug 10 '17 at 6:48
@cbp same for me - nothing changes
– PeterX
Mar 12 '18 at 23:04
I expect this may be dependent on system locale settings. The default selected option for me in the date format is "DMY" so I need to change the drop-down to match the actual format of the column.
– cmbuckley
Mar 13 '18 at 12:07
add a comment |
The problem is that a US date can parsed by Excel as a UK date when the day is less than 13. When this happens Excel converts it to the localized UK serial (date) number.
So 03/19/2014 is obviously a US date of the 19th of March. However 05/03/2014 is ambiguous so Excel parses it the local date format as the 5th of March, rather than the US 3rd of May. Any formula has to check if Excel has stored the US Date as a UK date. A UK date will be stored in Excel as a number.
=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
(For a US date in cell A2 and PC date is dd/mm/yy).
If ISNUMBER is true, the US date looks like a UK date and Excel has serialized it as a number. So can format the date as text and back to a date again. Note day is passed to the month parameter of the first DATE function to perform the conversion.
If ISNUMBER is false, its stored as a string as Excel doesn't convert a date string with >12 months. So use string functions to split it up for the DATE function.
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:44
This didn't work for "9/26/1976 2:00:00 PM" - I got "270" as as result that formatted to "1900-09-26"
– PeterX
Mar 12 '18 at 23:07
add a comment |
I'm assuming that the date you received is formatted as text and that simply formatting it as date is not changing anything. You can run the following formula on the date:
=(MID(A1,FIND("/",A1)+1,FIND("/",A1,FIND("/",A1)+1)-FIND("/",A1)-1)&"-"&LEFT(A1,FIND("/",A1)-1)&"-"&RIGHT(A1,4))*1
If you get numbers, you just need to format it as dd/mm/yyyy and it should be good.
add a comment |
I tried some of the other suggestions but none seemed to work for me. In my case I was importing US dates in the form M/d/yyyy hh:mm:ss. If you don't mind using some VBA in your spreadsheet then the following function did the job for me:
Public Function USDate(ds As Variant) As Variant
Dim sp() As String
Dim spt() As String
Dim spt2() As String
If ds = vbNullString Then
USDate = ""
ElseIf IsNumeric(ds) Then
' Convert numeric US dates wrongly interpreted as UK i.e. 1/7/2017 as 7th January 2017
USDate = DateSerial(Year(ds), Day(ds), Month(ds))
Else
sp = Split(ds, "/") ' split the date portion
spt = Split(sp(2), " ") ' split the time from the year
spt2 = Split(spt(1), ":") 'split the time hms
USDate = DateSerial(spt(0), sp(0), sp(1)) + TimeSerial(spt2(0), spt2(1), spt2(2))
End If
End Function
Thanks for https://stackoverflow.com/users/845584/peterx pointing out - you will need to create the function in a VBA code module to use this technique.
Simply use it in a spreadsheet formulae for example =USDate(A2)
I originally got a "#NAME?" error. You need to use it in a module as per here: stackoverflow.com/a/16296990/845584
– PeterX
Mar 12 '18 at 23:27
add a comment |
Related to this, the below simply formula can be helpful for changing a date from
"MM/DD/YYYY"
into
"DD/MM/YYYY".
=VALUE(TEXT(B2,"mm/dd/yyyy"))
I get the error "#VALUE!" for "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:08
add a comment |
We can get best of both world with this more concise formula:
=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
Can't find anything shorter.
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:45
As above, I get "270" for the American Date "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:09
add a comment |
There was one more issue for me, as somehow the raw data was supposed to be read as a number, but it did not. Hence, i updated the formula with 1 final case:
=IFERROR(IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2))),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,1)))
add a comment |
This can be tricky when the dates in mixed format eg. UK and US in the same column. I have found an effective if inelegant solution:
Step1) Select the column containing the dates to be converted;
Step2) Format, Cells, Text;
Step3) Format, Cells, Date, US;
Step4) Data, Text to column, Next, Delimited, Next, delete all delimiters, Next, select format MDY;
Step5) Format, Cells, Date, UK.
Step4 had been suggested elsewhere, but that on it's own didn't do it for me. I am hoping to combine these steps into a macro but no success this far.
add a comment |
I couldn't get the most common answer to work, the process that worked for me was:
For date 10/04/2018 11:49:20, right-click cell and "Format Cells", "Number" tab and select "Custom" Category and then select mm/dd/yyyy hh:mm.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18487247%2fexcel-2010-change-us-dates-to-uk-format%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
Another solution without using a formula:
- Select the relevant columns
- Choose Data → Text to Columns…
- Select “Delimited” and click Next
- Untick all delimiters and click Next
- Select data column format “Date: MDY” and click Finish
The dates should now be converted to UK dates.
2
Am I the only one for whom this technique literally does nothing?
– cbp
Aug 10 '17 at 6:48
@cbp same for me - nothing changes
– PeterX
Mar 12 '18 at 23:04
I expect this may be dependent on system locale settings. The default selected option for me in the date format is "DMY" so I need to change the drop-down to match the actual format of the column.
– cmbuckley
Mar 13 '18 at 12:07
add a comment |
Another solution without using a formula:
- Select the relevant columns
- Choose Data → Text to Columns…
- Select “Delimited” and click Next
- Untick all delimiters and click Next
- Select data column format “Date: MDY” and click Finish
The dates should now be converted to UK dates.
2
Am I the only one for whom this technique literally does nothing?
– cbp
Aug 10 '17 at 6:48
@cbp same for me - nothing changes
– PeterX
Mar 12 '18 at 23:04
I expect this may be dependent on system locale settings. The default selected option for me in the date format is "DMY" so I need to change the drop-down to match the actual format of the column.
– cmbuckley
Mar 13 '18 at 12:07
add a comment |
Another solution without using a formula:
- Select the relevant columns
- Choose Data → Text to Columns…
- Select “Delimited” and click Next
- Untick all delimiters and click Next
- Select data column format “Date: MDY” and click Finish
The dates should now be converted to UK dates.
Another solution without using a formula:
- Select the relevant columns
- Choose Data → Text to Columns…
- Select “Delimited” and click Next
- Untick all delimiters and click Next
- Select data column format “Date: MDY” and click Finish
The dates should now be converted to UK dates.
answered Mar 26 '15 at 10:52
cmbuckleycmbuckley
25.6k75474
25.6k75474
2
Am I the only one for whom this technique literally does nothing?
– cbp
Aug 10 '17 at 6:48
@cbp same for me - nothing changes
– PeterX
Mar 12 '18 at 23:04
I expect this may be dependent on system locale settings. The default selected option for me in the date format is "DMY" so I need to change the drop-down to match the actual format of the column.
– cmbuckley
Mar 13 '18 at 12:07
add a comment |
2
Am I the only one for whom this technique literally does nothing?
– cbp
Aug 10 '17 at 6:48
@cbp same for me - nothing changes
– PeterX
Mar 12 '18 at 23:04
I expect this may be dependent on system locale settings. The default selected option for me in the date format is "DMY" so I need to change the drop-down to match the actual format of the column.
– cmbuckley
Mar 13 '18 at 12:07
2
2
Am I the only one for whom this technique literally does nothing?
– cbp
Aug 10 '17 at 6:48
Am I the only one for whom this technique literally does nothing?
– cbp
Aug 10 '17 at 6:48
@cbp same for me - nothing changes
– PeterX
Mar 12 '18 at 23:04
@cbp same for me - nothing changes
– PeterX
Mar 12 '18 at 23:04
I expect this may be dependent on system locale settings. The default selected option for me in the date format is "DMY" so I need to change the drop-down to match the actual format of the column.
– cmbuckley
Mar 13 '18 at 12:07
I expect this may be dependent on system locale settings. The default selected option for me in the date format is "DMY" so I need to change the drop-down to match the actual format of the column.
– cmbuckley
Mar 13 '18 at 12:07
add a comment |
The problem is that a US date can parsed by Excel as a UK date when the day is less than 13. When this happens Excel converts it to the localized UK serial (date) number.
So 03/19/2014 is obviously a US date of the 19th of March. However 05/03/2014 is ambiguous so Excel parses it the local date format as the 5th of March, rather than the US 3rd of May. Any formula has to check if Excel has stored the US Date as a UK date. A UK date will be stored in Excel as a number.
=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
(For a US date in cell A2 and PC date is dd/mm/yy).
If ISNUMBER is true, the US date looks like a UK date and Excel has serialized it as a number. So can format the date as text and back to a date again. Note day is passed to the month parameter of the first DATE function to perform the conversion.
If ISNUMBER is false, its stored as a string as Excel doesn't convert a date string with >12 months. So use string functions to split it up for the DATE function.
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:44
This didn't work for "9/26/1976 2:00:00 PM" - I got "270" as as result that formatted to "1900-09-26"
– PeterX
Mar 12 '18 at 23:07
add a comment |
The problem is that a US date can parsed by Excel as a UK date when the day is less than 13. When this happens Excel converts it to the localized UK serial (date) number.
So 03/19/2014 is obviously a US date of the 19th of March. However 05/03/2014 is ambiguous so Excel parses it the local date format as the 5th of March, rather than the US 3rd of May. Any formula has to check if Excel has stored the US Date as a UK date. A UK date will be stored in Excel as a number.
=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
(For a US date in cell A2 and PC date is dd/mm/yy).
If ISNUMBER is true, the US date looks like a UK date and Excel has serialized it as a number. So can format the date as text and back to a date again. Note day is passed to the month parameter of the first DATE function to perform the conversion.
If ISNUMBER is false, its stored as a string as Excel doesn't convert a date string with >12 months. So use string functions to split it up for the DATE function.
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:44
This didn't work for "9/26/1976 2:00:00 PM" - I got "270" as as result that formatted to "1900-09-26"
– PeterX
Mar 12 '18 at 23:07
add a comment |
The problem is that a US date can parsed by Excel as a UK date when the day is less than 13. When this happens Excel converts it to the localized UK serial (date) number.
So 03/19/2014 is obviously a US date of the 19th of March. However 05/03/2014 is ambiguous so Excel parses it the local date format as the 5th of March, rather than the US 3rd of May. Any formula has to check if Excel has stored the US Date as a UK date. A UK date will be stored in Excel as a number.
=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
(For a US date in cell A2 and PC date is dd/mm/yy).
If ISNUMBER is true, the US date looks like a UK date and Excel has serialized it as a number. So can format the date as text and back to a date again. Note day is passed to the month parameter of the first DATE function to perform the conversion.
If ISNUMBER is false, its stored as a string as Excel doesn't convert a date string with >12 months. So use string functions to split it up for the DATE function.
The problem is that a US date can parsed by Excel as a UK date when the day is less than 13. When this happens Excel converts it to the localized UK serial (date) number.
So 03/19/2014 is obviously a US date of the 19th of March. However 05/03/2014 is ambiguous so Excel parses it the local date format as the 5th of March, rather than the US 3rd of May. Any formula has to check if Excel has stored the US Date as a UK date. A UK date will be stored in Excel as a number.
=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
(For a US date in cell A2 and PC date is dd/mm/yy).
If ISNUMBER is true, the US date looks like a UK date and Excel has serialized it as a number. So can format the date as text and back to a date again. Note day is passed to the month parameter of the first DATE function to perform the conversion.
If ISNUMBER is false, its stored as a string as Excel doesn't convert a date string with >12 months. So use string functions to split it up for the DATE function.
edited Mar 4 '14 at 22:29
Shevliaskovic
1,39641834
1,39641834
answered Mar 4 '14 at 22:04
user3155533user3155533
492
492
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:44
This didn't work for "9/26/1976 2:00:00 PM" - I got "270" as as result that formatted to "1900-09-26"
– PeterX
Mar 12 '18 at 23:07
add a comment |
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:44
This didn't work for "9/26/1976 2:00:00 PM" - I got "270" as as result that formatted to "1900-09-26"
– PeterX
Mar 12 '18 at 23:07
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:
=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2)))) I've tested it and looks like it work in all possible cases.– Wayfarer
Aug 2 '16 at 18:44
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:
=IF(ISNUMBER(A2),DATE(TEXT(A2,"yyyy"),TEXT(A2,"dd"),TEXT(A2,"mm")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2)))) I've tested it and looks like it work in all possible cases.– Wayfarer
Aug 2 '16 at 18:44
This didn't work for "9/26/1976 2:00:00 PM" - I got "270" as as result that formatted to "1900-09-26"
– PeterX
Mar 12 '18 at 23:07
This didn't work for "9/26/1976 2:00:00 PM" - I got "270" as as result that formatted to "1900-09-26"
– PeterX
Mar 12 '18 at 23:07
add a comment |
I'm assuming that the date you received is formatted as text and that simply formatting it as date is not changing anything. You can run the following formula on the date:
=(MID(A1,FIND("/",A1)+1,FIND("/",A1,FIND("/",A1)+1)-FIND("/",A1)-1)&"-"&LEFT(A1,FIND("/",A1)-1)&"-"&RIGHT(A1,4))*1
If you get numbers, you just need to format it as dd/mm/yyyy and it should be good.
add a comment |
I'm assuming that the date you received is formatted as text and that simply formatting it as date is not changing anything. You can run the following formula on the date:
=(MID(A1,FIND("/",A1)+1,FIND("/",A1,FIND("/",A1)+1)-FIND("/",A1)-1)&"-"&LEFT(A1,FIND("/",A1)-1)&"-"&RIGHT(A1,4))*1
If you get numbers, you just need to format it as dd/mm/yyyy and it should be good.
add a comment |
I'm assuming that the date you received is formatted as text and that simply formatting it as date is not changing anything. You can run the following formula on the date:
=(MID(A1,FIND("/",A1)+1,FIND("/",A1,FIND("/",A1)+1)-FIND("/",A1)-1)&"-"&LEFT(A1,FIND("/",A1)-1)&"-"&RIGHT(A1,4))*1
If you get numbers, you just need to format it as dd/mm/yyyy and it should be good.
I'm assuming that the date you received is formatted as text and that simply formatting it as date is not changing anything. You can run the following formula on the date:
=(MID(A1,FIND("/",A1)+1,FIND("/",A1,FIND("/",A1)+1)-FIND("/",A1)-1)&"-"&LEFT(A1,FIND("/",A1)-1)&"-"&RIGHT(A1,4))*1
If you get numbers, you just need to format it as dd/mm/yyyy and it should be good.
answered Aug 28 '13 at 12:17
JerryJerry
58.4k1069102
58.4k1069102
add a comment |
add a comment |
I tried some of the other suggestions but none seemed to work for me. In my case I was importing US dates in the form M/d/yyyy hh:mm:ss. If you don't mind using some VBA in your spreadsheet then the following function did the job for me:
Public Function USDate(ds As Variant) As Variant
Dim sp() As String
Dim spt() As String
Dim spt2() As String
If ds = vbNullString Then
USDate = ""
ElseIf IsNumeric(ds) Then
' Convert numeric US dates wrongly interpreted as UK i.e. 1/7/2017 as 7th January 2017
USDate = DateSerial(Year(ds), Day(ds), Month(ds))
Else
sp = Split(ds, "/") ' split the date portion
spt = Split(sp(2), " ") ' split the time from the year
spt2 = Split(spt(1), ":") 'split the time hms
USDate = DateSerial(spt(0), sp(0), sp(1)) + TimeSerial(spt2(0), spt2(1), spt2(2))
End If
End Function
Thanks for https://stackoverflow.com/users/845584/peterx pointing out - you will need to create the function in a VBA code module to use this technique.
Simply use it in a spreadsheet formulae for example =USDate(A2)
I originally got a "#NAME?" error. You need to use it in a module as per here: stackoverflow.com/a/16296990/845584
– PeterX
Mar 12 '18 at 23:27
add a comment |
I tried some of the other suggestions but none seemed to work for me. In my case I was importing US dates in the form M/d/yyyy hh:mm:ss. If you don't mind using some VBA in your spreadsheet then the following function did the job for me:
Public Function USDate(ds As Variant) As Variant
Dim sp() As String
Dim spt() As String
Dim spt2() As String
If ds = vbNullString Then
USDate = ""
ElseIf IsNumeric(ds) Then
' Convert numeric US dates wrongly interpreted as UK i.e. 1/7/2017 as 7th January 2017
USDate = DateSerial(Year(ds), Day(ds), Month(ds))
Else
sp = Split(ds, "/") ' split the date portion
spt = Split(sp(2), " ") ' split the time from the year
spt2 = Split(spt(1), ":") 'split the time hms
USDate = DateSerial(spt(0), sp(0), sp(1)) + TimeSerial(spt2(0), spt2(1), spt2(2))
End If
End Function
Thanks for https://stackoverflow.com/users/845584/peterx pointing out - you will need to create the function in a VBA code module to use this technique.
Simply use it in a spreadsheet formulae for example =USDate(A2)
I originally got a "#NAME?" error. You need to use it in a module as per here: stackoverflow.com/a/16296990/845584
– PeterX
Mar 12 '18 at 23:27
add a comment |
I tried some of the other suggestions but none seemed to work for me. In my case I was importing US dates in the form M/d/yyyy hh:mm:ss. If you don't mind using some VBA in your spreadsheet then the following function did the job for me:
Public Function USDate(ds As Variant) As Variant
Dim sp() As String
Dim spt() As String
Dim spt2() As String
If ds = vbNullString Then
USDate = ""
ElseIf IsNumeric(ds) Then
' Convert numeric US dates wrongly interpreted as UK i.e. 1/7/2017 as 7th January 2017
USDate = DateSerial(Year(ds), Day(ds), Month(ds))
Else
sp = Split(ds, "/") ' split the date portion
spt = Split(sp(2), " ") ' split the time from the year
spt2 = Split(spt(1), ":") 'split the time hms
USDate = DateSerial(spt(0), sp(0), sp(1)) + TimeSerial(spt2(0), spt2(1), spt2(2))
End If
End Function
Thanks for https://stackoverflow.com/users/845584/peterx pointing out - you will need to create the function in a VBA code module to use this technique.
Simply use it in a spreadsheet formulae for example =USDate(A2)
I tried some of the other suggestions but none seemed to work for me. In my case I was importing US dates in the form M/d/yyyy hh:mm:ss. If you don't mind using some VBA in your spreadsheet then the following function did the job for me:
Public Function USDate(ds As Variant) As Variant
Dim sp() As String
Dim spt() As String
Dim spt2() As String
If ds = vbNullString Then
USDate = ""
ElseIf IsNumeric(ds) Then
' Convert numeric US dates wrongly interpreted as UK i.e. 1/7/2017 as 7th January 2017
USDate = DateSerial(Year(ds), Day(ds), Month(ds))
Else
sp = Split(ds, "/") ' split the date portion
spt = Split(sp(2), " ") ' split the time from the year
spt2 = Split(spt(1), ":") 'split the time hms
USDate = DateSerial(spt(0), sp(0), sp(1)) + TimeSerial(spt2(0), spt2(1), spt2(2))
End If
End Function
Thanks for https://stackoverflow.com/users/845584/peterx pointing out - you will need to create the function in a VBA code module to use this technique.
Simply use it in a spreadsheet formulae for example =USDate(A2)
edited Mar 18 '18 at 14:52
answered Mar 21 '17 at 12:21
user2486488user2486488
4917
4917
I originally got a "#NAME?" error. You need to use it in a module as per here: stackoverflow.com/a/16296990/845584
– PeterX
Mar 12 '18 at 23:27
add a comment |
I originally got a "#NAME?" error. You need to use it in a module as per here: stackoverflow.com/a/16296990/845584
– PeterX
Mar 12 '18 at 23:27
I originally got a "#NAME?" error. You need to use it in a module as per here: stackoverflow.com/a/16296990/845584
– PeterX
Mar 12 '18 at 23:27
I originally got a "#NAME?" error. You need to use it in a module as per here: stackoverflow.com/a/16296990/845584
– PeterX
Mar 12 '18 at 23:27
add a comment |
Related to this, the below simply formula can be helpful for changing a date from
"MM/DD/YYYY"
into
"DD/MM/YYYY".
=VALUE(TEXT(B2,"mm/dd/yyyy"))
I get the error "#VALUE!" for "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:08
add a comment |
Related to this, the below simply formula can be helpful for changing a date from
"MM/DD/YYYY"
into
"DD/MM/YYYY".
=VALUE(TEXT(B2,"mm/dd/yyyy"))
I get the error "#VALUE!" for "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:08
add a comment |
Related to this, the below simply formula can be helpful for changing a date from
"MM/DD/YYYY"
into
"DD/MM/YYYY".
=VALUE(TEXT(B2,"mm/dd/yyyy"))
Related to this, the below simply formula can be helpful for changing a date from
"MM/DD/YYYY"
into
"DD/MM/YYYY".
=VALUE(TEXT(B2,"mm/dd/yyyy"))
edited Sep 29 '14 at 12:29
Horaciux
4,26921535
4,26921535
answered Sep 29 '14 at 12:05
JettiesburgJettiesburg
216
216
I get the error "#VALUE!" for "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:08
add a comment |
I get the error "#VALUE!" for "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:08
I get the error "#VALUE!" for "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:08
I get the error "#VALUE!" for "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:08
add a comment |
We can get best of both world with this more concise formula:
=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
Can't find anything shorter.
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:45
As above, I get "270" for the American Date "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:09
add a comment |
We can get best of both world with this more concise formula:
=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
Can't find anything shorter.
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:45
As above, I get "270" for the American Date "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:09
add a comment |
We can get best of both world with this more concise formula:
=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
Can't find anything shorter.
We can get best of both world with this more concise formula:
=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2)))
Can't find anything shorter.
answered Nov 6 '15 at 16:58
BoulebillBoulebill
91
91
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:45
As above, I get "270" for the American Date "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:09
add a comment |
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2))))I've tested it and looks like it work in all possible cases.
– Wayfarer
Aug 2 '16 at 18:45
As above, I get "270" for the American Date "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:09
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:
=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2)))) I've tested it and looks like it work in all possible cases.– Wayfarer
Aug 2 '16 at 18:45
This formula will return an error when the day has only one digit (days from 1 to 9) and does not have the leading zero, as in that case it will extract also the slash along with the symbol. I've found a workaround by modifying the way the day value is extracted:
=IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(LEFT(A2,FIND("/",A2,4)-1),FIND("/",A2)+1,LEN(A2)))) I've tested it and looks like it work in all possible cases.– Wayfarer
Aug 2 '16 at 18:45
As above, I get "270" for the American Date "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:09
As above, I get "270" for the American Date "9/26/1976 2:00:00 PM"
– PeterX
Mar 12 '18 at 23:09
add a comment |
There was one more issue for me, as somehow the raw data was supposed to be read as a number, but it did not. Hence, i updated the formula with 1 final case:
=IFERROR(IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2))),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,1)))
add a comment |
There was one more issue for me, as somehow the raw data was supposed to be read as a number, but it did not. Hence, i updated the formula with 1 final case:
=IFERROR(IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2))),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,1)))
add a comment |
There was one more issue for me, as somehow the raw data was supposed to be read as a number, but it did not. Hence, i updated the formula with 1 final case:
=IFERROR(IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2))),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,1)))
There was one more issue for me, as somehow the raw data was supposed to be read as a number, but it did not. Hence, i updated the formula with 1 final case:
=IFERROR(IF(ISNUMBER(A2),VALUE(TEXT(A2,"mm/dd/yyyy")),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,2))),DATE(RIGHT(A2,4),LEFT(A2,FIND("/",A2)-1),MID(A2,FIND("/",A2)+1,1)))
answered Dec 6 '16 at 3:08
w31hon9w31hon9
114
114
add a comment |
add a comment |
This can be tricky when the dates in mixed format eg. UK and US in the same column. I have found an effective if inelegant solution:
Step1) Select the column containing the dates to be converted;
Step2) Format, Cells, Text;
Step3) Format, Cells, Date, US;
Step4) Data, Text to column, Next, Delimited, Next, delete all delimiters, Next, select format MDY;
Step5) Format, Cells, Date, UK.
Step4 had been suggested elsewhere, but that on it's own didn't do it for me. I am hoping to combine these steps into a macro but no success this far.
add a comment |
This can be tricky when the dates in mixed format eg. UK and US in the same column. I have found an effective if inelegant solution:
Step1) Select the column containing the dates to be converted;
Step2) Format, Cells, Text;
Step3) Format, Cells, Date, US;
Step4) Data, Text to column, Next, Delimited, Next, delete all delimiters, Next, select format MDY;
Step5) Format, Cells, Date, UK.
Step4 had been suggested elsewhere, but that on it's own didn't do it for me. I am hoping to combine these steps into a macro but no success this far.
add a comment |
This can be tricky when the dates in mixed format eg. UK and US in the same column. I have found an effective if inelegant solution:
Step1) Select the column containing the dates to be converted;
Step2) Format, Cells, Text;
Step3) Format, Cells, Date, US;
Step4) Data, Text to column, Next, Delimited, Next, delete all delimiters, Next, select format MDY;
Step5) Format, Cells, Date, UK.
Step4 had been suggested elsewhere, but that on it's own didn't do it for me. I am hoping to combine these steps into a macro but no success this far.
This can be tricky when the dates in mixed format eg. UK and US in the same column. I have found an effective if inelegant solution:
Step1) Select the column containing the dates to be converted;
Step2) Format, Cells, Text;
Step3) Format, Cells, Date, US;
Step4) Data, Text to column, Next, Delimited, Next, delete all delimiters, Next, select format MDY;
Step5) Format, Cells, Date, UK.
Step4 had been suggested elsewhere, but that on it's own didn't do it for me. I am hoping to combine these steps into a macro but no success this far.
answered Jan 1 '17 at 16:45
marenmaren
1
1
add a comment |
add a comment |
I couldn't get the most common answer to work, the process that worked for me was:
For date 10/04/2018 11:49:20, right-click cell and "Format Cells", "Number" tab and select "Custom" Category and then select mm/dd/yyyy hh:mm.
add a comment |
I couldn't get the most common answer to work, the process that worked for me was:
For date 10/04/2018 11:49:20, right-click cell and "Format Cells", "Number" tab and select "Custom" Category and then select mm/dd/yyyy hh:mm.
add a comment |
I couldn't get the most common answer to work, the process that worked for me was:
For date 10/04/2018 11:49:20, right-click cell and "Format Cells", "Number" tab and select "Custom" Category and then select mm/dd/yyyy hh:mm.
I couldn't get the most common answer to work, the process that worked for me was:
For date 10/04/2018 11:49:20, right-click cell and "Format Cells", "Number" tab and select "Custom" Category and then select mm/dd/yyyy hh:mm.
edited Nov 14 '18 at 12:43
Matheus Lacerda
2,888101830
2,888101830
answered Nov 14 '18 at 12:20
PuffTMDPuffTMD
437
437
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18487247%2fexcel-2010-change-us-dates-to-uk-format%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can filter the csv before importing in Excel with Powershell on Windows of (after ftp to *nix server) ksh/bash on *nix.
– Walter A
Dec 5 '14 at 10:33