+ Reply to Thread
Results 1 to 25 of 25

Changing US date format to UK format - using a formula

  1. #1
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Changing US date format to UK format - using a formula

    Hi there,

    I am using the XLTools calendar on the attached sheet, I can't get service pack 6 so am unable to use the Microsoft one.

    The date format in this calendar is US, either mm/dd/yyyy or mm/d/yyyy, depending on the day of the month.

    I am trying to use a formula to alter this to the UK format of dd/mm/yyyy (and/or d/mm/yyyy if necessary). It is not possible to format the cell as normal, I have tried formulas I've found online but to no avail. Some work for any date of 1st-12th of the month but not 13th onwards, or vice versa.

    If you look at the sheet, cell Q18 is where the date result from the calendar will be, I need cell C8 to show the date in UK format.

    I would appreciate any help/advice you could give.

    Many thanks in advance.

    Matt
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Changing US date format to UK format - using a formula

    I don't understand. if i have =Q18 in C8... and enter 24/10/2016 in Q18... I see 24/10/2016 in C8. What am I meant to see?

    Are the regional settings on your PC set to UK??
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Sorry, I didn't explain too well. You use the calendar to select your date, the date will then show in whichever cell is selected (I will click cell Q18 before I select a date on the calendar).

    Q18 will then show the US format date. There needs to be a formula in C8 which pulls the date from Q18 and formats it to the UK date.

    The settings on my PC are UK, this is a known issue with the XL Tools calendar.

    I hope that makes sense.

    Thanks

    Matt

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Changing US date format to UK format - using a formula

    for me, when I open your file, the calendar is just a picture... I don't think that I can help you...

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Changing US date format to UK format - using a formula

    It looks like you won't be doing any calculations that reference cell C8 so you can use this formula which will return the date from Q18 as a TEXT string in the dd/mm/yyyy format:

    =TEXT(Q18,"dd/mm/yyyy")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Changing US date format to UK format - using a formula

    If you format Q18 as a number, do you get 42669? If do, what do you see in C8 if you enter (in c8):

    =DATE(YEAR(Q18),MONTH(Q18),DAY(Q18))

    and format as a date?

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Changing US date format to UK format - using a formula

    On a side note...

    There should be an international standard for date formats.

    d/m/y or m/d/y, one or the other!

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Changing US date format to UK format - using a formula

    Tony, what am I doing wrong that is preventing the date picker from working for me?

  9. #9
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Hi Tony,

    Unfortunately this does not work, this is one of the one's I found online. If the date is the 13th of the month or later, it works. If the date is the 1st-12th of the month it doesn't.

    Glenn,

    I inserted the calendar from the store on the insert menu, see pic, if that helps?

    Appreciate both of you helping.

    Matt
    Attached Images Attached Images

  10. #10
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by Tony Valko View Post
    On a side note...

    There should be an international standard for date formats.

    d/m/y or m/d/y, one or the other!
    I agree completely, would make life so much easier!

  11. #11
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by Glenn Kennedy View Post
    If you format Q18 as a number, do you get 42669? If do, what do you see in C8 if you enter (in c8):

    =DATE(YEAR(Q18),MONTH(Q18),DAY(Q18))

    and format as a date?
    Have tried this Glenn, doesn't appear to work.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by Glenn Kennedy View Post
    Tony, what am I doing wrong that is preventing the date picker from working for me?
    Sounds like it uses an add-in:

    Quote Originally Posted by menolas View Post
    ou use the calendar to select your date, the date will then show in whichever cell is selected (I will click cell Q18 before I select a date on the calendar).

    ...the XL Tools calendar.
    If you don't have the add-in then it doesn't work as designed.

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by menolas View Post
    Hi Tony,

    Unfortunately this does not work, this is one of the one's I found online. If the date is the 13th of the month or later, it works. If the date is the 1st-12th of the month it doesn't.
    Let's assume the date in Q18 is 10/12/2016 (U.S. date format of m//d/y).

    What result do you get in C8 with this formula:

    =TEXT(Q18,"dd/mm/yyyy")

  14. #14
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    it returns the date in the same format 10/12/2016

  15. #15
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    I have to leave the office now and won't have access to a PC until 9am tomorrow, thanks for your help guys, if you do reply between now and then I'll respond as soon as I get in.

    Appreciate you taking the time to assist me.

    Thanks

    Matt

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Changing US date format to UK format - using a formula

    Maybe this...

    =DAY(Q18)&"/"&MONTH(Q18)&"/"&YEAR(Q18)

    That'll return a TEXT string in the format d/m/yyyy.

    If you want d/mm/yyyy...

    =DAY(Q18)&"/"&TEXT(MONTH(Q18),"00")&"/"&YEAR(Q18)

    If you want dd/mm/yyyy...

    =TEXT(DAY(Q18),"00")&"/"&TEXT(MONTH(Q18),"00")&"/"&YEAR(Q18)

  17. #17
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Changing US date format to UK format - using a formula

    I note that Q18 is preformatted as text ("@"), and that =ISTEXT(Q18) returns TRUE. It seems to me that however the date is getting entered into Q18, someone has put some effort to make sure that Q18 is a text string and not a real date value. Perhaps the first step is to convert the date as text to a real date serial number (perhaps using the DATEVALUE() function). Once the date is converted to a serial number, you can then format it however you want using built in or custom date format codes.

    If you want to store C8 as a text string, then you can simply add the DATEVALUE() function to Tony Valko's formula in post #13. =TEXT(DATEVALUE(Q18),...)
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  18. #18
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by MrShorty View Post
    I note that Q18 is preformatted as text ("@"), and that =ISTEXT(Q18) returns TRUE. It seems to me that however the date is getting entered into Q18, someone has put some effort to make sure that Q18 is a text string and not a real date value. Perhaps the first step is to convert the date as text to a real date serial number (perhaps using the DATEVALUE() function). Once the date is converted to a serial number, you can then format it however you want using built in or custom date format codes.

    If you want to store C8 as a text string, then you can simply add the DATEVALUE() function to Tony Valko's formula in post #13. =TEXT(DATEVALUE(Q18),...)
    Unfortunately this does not work for me, any date form 1st - 12th still shows in US format and any date from 13th onwards returns #VALUE!

  19. #19
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by Tony Valko View Post
    Maybe this...

    =DAY(Q18)&"/"&MONTH(Q18)&"/"&YEAR(Q18)

    That'll return a TEXT string in the format d/m/yyyy.

    If you want d/mm/yyyy...

    =DAY(Q18)&"/"&TEXT(MONTH(Q18),"00")&"/"&YEAR(Q18)

    If you want dd/mm/yyyy...

    =TEXT(DAY(Q18),"00")&"/"&TEXT(MONTH(Q18),"00")&"/"&YEAR(Q18)
    The same for these I'm afraid, 1st-12th shows as US format, the rest return #VALUE!

  20. #20
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Changing US date format to UK format - using a formula

    Try

    =DATEVALUE(SUBSTITUTE(MID(Q18,FIND("/",Q18)+1,7),"/","/"&LEFT(Q18,FIND("/",Q18))))

    Or enter this code into the worksheet module, (right click the sheet tab in excel, then View Code') and save your workbook with a .xlsm file extension, then select C8 before using the date picker. The code eliminates the need for the extra cell (Q18).

    Please Login or Register  to view this content.

  21. #21
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Changing US date format to UK format - using a formula

    Try this formula:

    =IF(ISNUMBER(Q18),DATE(YEAR(Q18),DAY(Q18),MONTH(Q18)),DATE(RIGHT(Q18,4),LEFT(Q18,FIND("/",Q18)-1),SUBSTITUTE(MID(Q18,FIND("/",Q18)+1,2),"/","")))

    Format as a date in the style you require.

    Hope this helps.

    Pete

  22. #22
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by menolas View Post
    I agree completely, would make life so much easier!
    Just my opinion, but I think it comes from the natural way dates are spoken.In the UK we usually say 'The second of January' where as in the US it is more natural to say 'January Second', unless it is a special day where they adopt the more formal 'the fourth of July'.
    Frob first, tweak later

  23. #23
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by jason.b75 View Post
    Try

    =DATEVALUE(SUBSTITUTE(MID(Q18,FIND("/",Q18)+1,7),"/","/"&LEFT(Q18,FIND("/",Q18))))

    Or enter this code into the worksheet module, (right click the sheet tab in excel, then View Code') and save your workbook with a .xlsm file extension, then select C8 before using the date picker. The code eliminates the need for the extra cell (Q18).

    Please Login or Register  to view this content.
    Thanks Jason! This works a treat, I've gone with the first option, I prefer to avoid code where possible.
    Really appreciate your help!

  24. #24
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Thank you everyone for your help, much appreciated.

  25. #25
    Registered User
    Join Date
    10-26-2016
    Location
    Lichfield, England
    MS-Off Ver
    2013
    Posts
    14

    Re: Changing US date format to UK format - using a formula

    Quote Originally Posted by Pete_UK View Post
    Try this formula:

    =IF(ISNUMBER(Q18),DATE(YEAR(Q18),DAY(Q18),MONTH(Q18)),DATE(RIGHT(Q18,4),LEFT(Q18,FIND("/",Q18)-1),SUBSTITUTE(MID(Q18,FIND("/",Q18)+1,2),"/","")))

    Format as a date in the style you require.

    Hope this helps.

    Pete
    Thanks Pete, didn't get round to trying this one as Jason's worked, but appreciate you taking the time to help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula for changing the date format
    By sharathnarayanan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-28-2014, 09:50 AM
  2. Changing the format to a date embedded in a formula
    By nappy1001 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-04-2014, 05:29 AM
  3. [SOLVED] Need Formula to Change Date Format without changing the timestamp
    By siobeh in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-13-2014, 04:41 PM
  4. [SOLVED] Formula for Changing date format 3-12-13 to format d-mm-yy.
    By UNAB in forum Excel General
    Replies: 2
    Last Post: 04-08-2013, 03:52 PM
  5. Changing date format in formula
    By rhudgins in forum Excel General
    Replies: 6
    Last Post: 03-29-2011, 11:19 AM
  6. Formula required for date without changing the date format
    By suryaprasad in forum Excel General
    Replies: 1
    Last Post: 01-28-2009, 08:04 AM
  7. [SOLVED] Formula for changing date format
    By juamig in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2006, 02:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1