+ Reply to Thread
Results 1 to 27 of 27

Format a date

  1. #1
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Format a date

    Hi I have an excel sheet and one of the fields is a date written in the format ex: 17th December 2017. This is currently a text field but I want to import it in an access database as a date field. Is there a way I can format this kind of date?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,871

    Re: Format a date

    Add a column using this formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where the date field is in A1, and copy down. This assumes that all dates are in exactly the format you gave, with standard ordinal numbers (ex: 1st, 2nd, 3rd, 4th).
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Format a date

    Unfortunately it is giving me a #value error. This is an example of 3 dates from a list:

    25th November 1820
    14th March 1821
    6th July 1821

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Format a date

    Or try

    =DateValue(SUBSTITUTE(A1,MID(A1,FIND(" ",A1,1)-2,2),"",1))

    Try this instead of the above:

    =SUBSTITUTE(A1,MID(A1,FIND(" ",A1,1)-2,2),"",1)

    The error is because Excel only does dates after Jan 1 1900.
    Last edited by MarvinP; 05-18-2017 at 03:41 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    @6SJ: I'll give you that on brevity

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    @MarvinP: should that not be:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Also points for brevity

  8. #8
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Format a date

    @MarvinP...why did you include B1...what should be there in B1? Is it where the formula is going to be written?

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    Unfortunately it is giving me a #value error. This is an example of 3 dates from a list:
    Your dates are pre-1900. The date system starts from 01/01/1900

  10. #10
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Format a date

    Nope still doesn't work

  11. #11
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Format a date

    @TMS so the functions available do not work on pre 1900?

  12. #12
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Format a date

    See my above post where I edited my answer..

  13. #13
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Format a date

    @MarvinP thanks a lot...there is no way I can work with pre 1900 dates in excel?

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    Nope still doesn't work
    What doesn't. You have three solutions. I suspect that none of them will work.

  15. #15
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Format a date

    Try this
    Enter in B1 and copy down
    Format as Date
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 17th December 2017 12/17/2017
    2 1st January 2016 1/1/2016
    3 3rd March 2018 3/3/2018
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date


  17. #17
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Format a date

    I think none are working as they are pre 1900 dates...even the last solution given by AlKey...it is giving me N/A as an error

  18. #18
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    @AlKey: and more points for brevity. Now I'm getting embarrassed

  19. #19
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Format a date

    You can "work with them" as text strings but using Excel's DateValue just doesn't work. You could build some type of converter from the text string to your own date converted number, if you tried.

    I do some genealogy and have this problem with old dates.

    Look at

    http://www.exceluser.com/formulas/earlydates.htm

  20. #20
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    Can't say this a different way. The Excel Date functions do NOT work with pre-1900 dates. Whilst the errors may be different, they just don't work.

  21. #21
    Registered User
    Join Date
    12-10-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Format a date

    What I am thinking is that maybe I will get a substring of the dates and subdivide them in 3 fields and then concatenate them to form the date...do you think it is a solution?

  22. #22
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    All the formulae produce a Text string that looks like a date. It's the DateValue part that doesn't work. So, you can have a Text string and then use Text to Columns to split it up. However, in order to sort the three columns effectively, you would need to convert the month name to a number.

  23. #23
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Format a date

    AND - here is a page that shows the code to do that..

    https://www.extendoffice.com/documen...to-number.html

  24. #24
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Format a date

    Quote Originally Posted by TMS View Post
    @AlKey: and more points for brevity. Now I'm getting embarrassed
    I only read the original post. The OP didn't mention that there will be dates pre-1900

  25. #25
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,975

    Re: Format a date

    But kuTools is not free, if I understand correctly.

  26. #26
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Format a date

    Trevor - You are correct (no surprise)

    Then use this function to convert the text to month number.

    =MONTH(DATEVALUE(A1&"1"))

    This works for long MMMM and short MMM text.

    Month Text to Month Number.xlsx

  27. #27
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Format a date

    This will do it
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. Converting from the 1904 date format to the 1900 date format without losing data
    By Patty McJorst in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-01-2020, 12:53 PM
  2. [SOLVED] Converting Date & Time (General format) to Date (Date format)
    By supremenuts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2017, 12:55 PM
  3. Replies: 4
    Last Post: 04-29-2015, 08:36 AM
  4. Date Format Of User PC Changes Display format date of Excel File after update
    By waihar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2014, 03:09 AM
  5. Replies: 5
    Last Post: 02-08-2013, 11:06 AM
  6. Need Formula/VBA Code to convert date in String Format to Normal Date format
    By Karthik Sen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2012, 04:54 AM
  7. Column Range with date Format MM/DD/YYYY independate of sys date Format
    By gaursh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2011, 03:31 AM

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