Comments on: How to convert text to date and number to date in Excel

The tutorial explains how to use Excel functions to convert text to date and how to turn text strings into dates in a non-formula way. You will also learn how to quickly change a number to date format. Continue reading

Comments page 2. Total comments: 731

  1. Hi! How can I convert YYYY-MM to MM/YYYY format? Please help

  2. Hello,
    I used Oracle and exported a .csv file. This is how I got it:

    August 01, 2023 14:00:00

    Now I cannot sort it from old to new and vice versa, so what can be done to make it in DATE format? I have done a lot but unable to achieve anything.

    1. I managed it. I made a text file from the .csv and then re-imported the data into the new .xlsx file.

  3. How would I convert a date formatted as 1st Mar 23 7:50AM, into 01/03/23, Thanks.

    1. Hi! To get a date from text, extract the year month and day from the text. Then use the DATE function to get the date. You can extract the year month and day from text using substring functions, and you can also use the TEXTSPLIT and CHOOSECOLS functions. TEXTSPLIT will divide the text into parts by spaces, and CHOOSECOLS will help you select the part of the text where the year, month or day is written.

      =DATE(20&CHOOSECOLS(TEXTSPLIT(A1," ",),3), MONTH(1&CHOOSECOLS(TEXTSPLIT(A1," ",),2)), LEFT(LEFT(A1,SEARCH(" ",A1)-1),LEN(LEFT(A1,SEARCH(" ",A1)-1))-2))
      or
      =DATE(20&MID(A1,SEARCH(" ",A1,6)+1,2), MONTH(1&MID(A1,SEARCH(" ",A1,3)+1,3)), LEFT(LEFT(A1,SEARCH(" ",A1)-1),LEN(LEFT(A1,SEARCH(" ",A1)-1))-2))

      I recommend paying attention to the Text to Date tool. This tool easily converts text strings of different formats to dates in one click. The tool is included in the Ultimate Suite for Excel and can be used in a free trial to see how it works.

  4. Hi.
    Please help me to convert this data ISSUE DATE-1-10-2017 into a date format like 01-Oct-2017. I tried many times but it didn't work.

    Thank you

      1. Thank you so much

  5. how to change this date format December 14, 2023 to 14/12/2023

  6. how to convert 29/12/2023 at 06:08:50.000 PM into 2021-12-31T09:23:06.369Z

  7. Hi, I am trying to convert text to date/time so I can use a filter to put them in chronological order. As the dates/times are transactions they are in the following format: DD/MM/YYYY HH:MM:SS and I cannot seem to convert them and filtering via text does not work correctly. I would also like this format to be set in a template that can be downloaded and used by other colleagues so whatever is input in that column can be filtered in the same way, even if it is copy/pasted, as opposed to everyone having to use a formula each time. Is this possible?

    1. Hi! To convert text to date and time, I recommend using math operations (multiply by 1) or Paste Special (add zero) as described in the article above.

  8. Hi,

    I was trying to convert this 10012023 to 10/01/2023, i tried this formula, =TEXT(DATE(RIGHT(T4,4),LEFT(T4,1),MID(T4,2,2)),"MM/DD/YYYY") but the result is this 01012023.

    Thank you for the help

    1. Hi! Please pay attention which characters you extract using the LEFT and MID functions. Try the formula:

      =TEXT(DATE(RIGHT(T4,4),LEFT(T4,2),MID(T4,4,2)),"MM/DD/YYYY")

      You can use the formula

      =DATE(RIGHT(T4,4),LEFT(T4,2),MID(T4,4,2))

      Apply the date format "MM/DD/YYYYYY".

      1. 26/07/2021-15/09/2021 need to change it to

        07/26/2021-09/15/2021 the above formula is giving wrong answer

        1. Hi! Your data is not dates, but a text string. You can extract the start and end dates using the LEFT, MID, and RIGHT functions. Then, convert them to actual dates using DATEVALUE.

          =DATEVALUE(LEFT(A1, 10))
          =DATEVALUE(RIGHT(A1, 10))
          =DATEVALUE(MID(A1, 12, 10))

          I can also offer a solution without the formulas.
          If you prefer a non-formula approach, you can use the Text to Columns wizard:
          Select the cell with the date range.
          Go to the “Data” tab and click “Text to Columns.”
          Choose the delimiter (-) and specify the format for the resulting column (e.g., “Date”).
          Click “Finish” to convert the text dates to two actual dates.

  9. HI,

    This is awesome. Thank you very much. i have my date imported in this format ~40464%, please how do i convert it.

  10. Hi Dev Team,
    I have the data like this :
    Sep 26, 1989

    But I apply the date with this formulae:
    =DATE(YEAR(cell),MONTH(cell),DAY(cell)).

    It shows me error. PLease suggest me

    1. Hi! If I understand correctly, your date is written as text. Use substring functions to extract separate parts of the date from the text string. Try this formula:

      =DATE(RIGHT(A1,4), MONTH(1&LEFT(A1,3)), MID(A1,5,2))

      I recommend paying attention to the Text to Date tool. This tool easily converts text strings of different formats to dates. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.

      1. I will really pay the attention on this.
        Thanks 1000 times.

  11. 2023/10/09 08:36:51

    Hi, I am struggling to put this date and time format in general or text format that still displays as per above that it can be utilized in a pivot table.
    If I put it in general format it displays as

    45208 3589236111

  12. GMT
    2022_121:00:00:00.000
    2022_122:00:00:00.000
    2022_123:00:00:00.000
    2022_126:00:00:00.000

    I need to convert the above GMT time to a time usable by excel.
    The above is what is entered into the cell by the data pull. I need to pull a time delta between the value, but i need to convert into something usable by excel.
    THanks

  13. Hi can any one share that how we can add text in my date in once cell showing e.g (Date as of : 03-Oct-23)

  14. Wow this is fantastic info! What formula would convert Aug182023 to a date format? All the dates have a three letter month, two number day, and four number year. (I don't want to use the Text to Columns wizard.)

  15. I'm trying to change this 2016-08-08T13:00:00.000Z to 2016-08-08 in excel

  16. Svetlana Cheusheva
    I cannot thank you enough.
    You are my Hero!

  17. I need help to convert date 07-01-2002 from below
    20020701

    1. Hi! Pay attention to the following paragraph of the article above: How to convert 8-digit number to date in Excel.

  18. Need to convert YYMMDDHHMM to DDMMYY format. Can someone help

  19. Nice formual to use in excel. Thanks.

  20. Dear Svetlana, Alexander,

    Unless I misread and missed an answer to my issue in your post and other solutions, would you be able to give a hint how to deal with the following situation?

    I am working on a Dutch machine and receive dates hard-coded in the csv file as "21MAR2024". Data import GUI offers "DMY" option how you suggest, but my Excel is unable to read the result. It would it read it had it "21MRT2024" written been.

    Without installing another language pack, writing a macro or substituting "MAR" with "MRT", is there any other way to force Excel to recognize the correct date in my case?

    Regards,

    1. Hi! Excel in dates uses your computer's local settings. So the best choice, I think, would be substituting.

      1. Dear Alexander,

        Thank you for a quick answer!

  21. I have a date that shows as 18/11/2015 10:04:38 AM that is generated from an external database. The number format is General. I have tried several tips you suggested above to convert to a date format i can use for my pivot table, but none works. Can you help?

  22. how to covert Friday, March 03, 2023 4:42:12 PM to 3/3/2023 16:42

  23. Thank you much. You helped me a lot!

  24. if Feb'23 then result should be 1-Feb-2023 and in next cell 28-Feb-2023 (ie. start date and end date); if its Jan23-Mar23 it should be 1-Jan-2023 and 31-Mar-2023. Please help me with this

  25. I have dates in the format 02-12-2022 and I want to convert them to 02-Dec-2022. I am using the below formula but it does not see to work after day 12th.

    =IF(ISNUMBER(C2),DATE(YEAR(C2),DAY(C2),MONTH(C2)),DATE(MID(C2,LEN(C2)-3,4),LEFT(C2,LEN(C2)-8),MID(C2,LEN(C2)-6,2)))

    If I apply this formula to 12-12-2022 it gives me 12-Dec-2022 but as soon as the day value changes to 13 i.e, 13-12-2022 it gives 12-Jan-2023.

    Please help!!!!

    1. Hi!
      If I understand your task correctly, try the following formula:

      =IF(ISNUMBER(C2),DATE(YEAR(C2),DAY(C2),MONTH(C2)),DATE(MID(C2,LEN(C2)-3,4),MID(C2,LEN(C2)-6,2),LEFT(C2,LEN(C2)-8)))

      I'd recommend you to have a look at our Text to Date tool. This simple tool effortlessly converts text strings of different formats into dates without formulas. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.

  26. Hello. Is there a way to translate a sequence of numbers in to date and time. As an example, to convert 2303252000 to 25/03/2023 20:00. This format is used by ICAO on NOTAM YYMMDDhhmm.

      1. Hello. Thank you very much for your reply. It was very helpfull! I used the following formula (with ; rather , (excel2007 user :( ) and adding 20& for 2000+ year and it worked
        =DATE((20&MID(A1;1;2));MID(A1;3;2);MID(A1;5;2))+TIME(MID(A1;7;2);MID(A1;9;2);0)

        Thank you very much again!

  27. Hello,
    Im trying to insert data from MSSQL with SSIS into Excel. In MSSQL date is DATETIME or DATETIME2, everything looks good until insert into excel when excel formats it by itself to DATE without TIME in the rows and date with time is shown only in formula box. How to set Excel so it will show exactly as im importing from database with DATETIME in rows and it is DATE type in excel also with time in rows?
    Thanks for your help.

  28. Hi. I have a problem that I can not solve. I have a Serial Number of equipment i.e 1Z6A08655AT. I need to take out from it the production date - these is represented by two first characters 1Z. 1 stands for 2021, Z stands for December.

    First character indicating Year
    1 is 2021,
    2 is 2022,
    3 is 2023
    ...

    Second represent months:
    1,2,3,4,5,6,7,8,9, X,Y,Z

    I need to have outcome in mmm-yy format

    No idea how to deal with it. Appreciate if you could share how to fix this ;)

    1. Hi!
      Use the MATCH function to find a match for the month character.

      =MATCH(MID(A1,2,1), {"1","2","3","4","5","6","7","8","9","X","Y","Z"}, 0)

      To get the year, use this formula

      LEFT(A1,1)+2020

      Use the DATE function to get the production date.

      =DATE(LEFT(A1,1)+2020, MATCH(MID(A1,2,1), {"1","2","3","4","5","6","7","8","9","X","Y","Z"},0),1)

      Hope this is what you need.

      1. This was awesome. I just coincidentally had the same challenge and this helped massively. Thank you

  29. Hi,

    I have extracted data from my netbank and receive the dates in decimal numbers, such as;
    Date
    0,150497685
    0,108831019
    0,067164352
    0,858136574

    How can I concert this to dates?

  30. Hi,

    I have dates in the format 02-12-2022 and I want to convert them to 02-Dec-2022. I am using the below formula but it does not see to work after day 12th.

    =IF(ISNUMBER(C2),DATE(YEAR(C2),DAY(C2),MONTH(C2)),DATE(MID(C2,LEN(C2)-3,4),LEFT(C2,LEN(C2)-8),MID(C2,LEN(C2)-6,2)))

    If I apply this formula to 12-12-2022 it gives me 12-Dec-2022 but as soon as the day value changes to 13 i.e, 13-12-2022 it gives 12-Jan-2023.

    Can you please help me?

    1. Hi Team,

      Can someone please respond here?

  31. By reading the comments I am sure you can help. I exported a report from a tool, the report has a date column but the column has two different date formats, one format interprets the date correctly, but the other format interprets the day as the month, so even all data is from January from example, when I filter the date what should be Jan 1- Jan 12 shows as Jan 1st, Feb 1st, march 1st and so on, how can I correct that, Thank you in advance.

    1. I found a solution.

  32. Hi i have an issue, i got sent a table that has Date column as 18-Oct, 18-Nov, 18-Dec, 19-Jan, 19-Feb, 19-March but excel reads it as 10/18/2023 but the column is actually suppose to read October 2018 ... Jan 2019, so this is affecting my work, and have tried what i know, the result i get is NAME ERROR

  33. I have the below text structure downloaded from a dataset that I need to convert into a date format that SPSS or Jamovi can use. I do not need the day of the week, just a numeric MM/DD/YYYY. I've tried converting by formatting the cells as dates, using the flash fill tool, and using =DATEVALUE, but none worked (no change at all). I will ultimately have thousands of entries; so, manual conversion is not feasible! Any ideas on how I can convert? The original date selection was made using a calendar tool where one selects a specific date and the text date is produced in the .csv download, if that's helpful.

    Mon Dec 27 2021

    Thank you!

    1. Hello!
      Use substring functions to extract the desired parts of the text for the DATE function. We have a more universal and simple solution that will solve the problem in a couple of clicks. I recommend paying attention to the Text to Date tool. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.

      =DATE(RIGHT(D1,4), MONTH(1&MID(D1,5,3)), MID(D1,9,2))

      1. Thanks so much! I'll give these recommendations a try.

  34. Hey there! I am trying to show a range of dates - "Number of Days" - that calls back to two other dates outside the print area. But the two dates keep showing up as text.

    I am using the following super basic formula. =C9&" ("&C11&" - "&C10&")"

    C11 and C10 are my two dates that show up as text. I want them to show up s mm/dd/yyyy. Can you help a newb out?

  35. Hi, I've got

    "Tue Nov 29 2022 15:50:53 GMT-0600 (Central Standard Time)" and would like it formatted into: "MM YYYY"

    Any ideas are greatly appreciated! Thank you!

  36. Hi, hope you can help

    I have the following "Apr 3, 2021 3:54am" and want to convert it to UK Date format using a formula - 03/04/21

    I know I can use the text to columns function but there are multiple columns like this so would be helpful if there was a formula, I tried looking above at the other solutions but could not see one like mine

    Thanks in advance

    1. Hello!
      To convert your text to a date, use this formula.

      =DATE(MID(A1,FIND("~",SUBSTITUTE(A1," ","~",2),1)+1,4), VLOOKUP(LEFT(A1,3), {"JAN",1;"FEB",2;"MAR",3;"APR",4;"May",5;"JUN",6;"JUL",7;"AUG",8;"Sep",9;"OCT",10;"NOV",11;"DEC",12},2,0), MID(A1,FIND(" ",A1,1)+1,SEARCH(",",A1,1)-5))

      In one click, the text is converted to a date using the Text to Date tool. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.

  37. Here's a "neat" method to convert an 8-digit number into a valid dd/mm/yyyy date:
    (Don't forget to format the result as "short date" 😎 )

    if cell A1 contains: 20220512

    then this formula: =TEXT(A1,"0000\/00\/00")+0

    will yield the date: 12/05/2022

    This is, of course, much simpler method than your solution, explained above:
    =DATE(RIGHT(A1,4), MID(A1,3,2), LEFT(A1,2))

    Enjoy

  38. I'm doing a complicated append formula and when I pull the cell that has the date information it translates it into the Date Value. Is there a way inside of the append formula to have it display the date from the date value? For example, Y2 holds the date displayed as 4/1/2022
    My append formula (I'm keeping it simple as there are about 10 other appends in the cell I'm merging everything into) is ="Paid Thru Date: "&Y2&"... "
    This formula is displaying: Paid Thru Date: 44652...
    I would like it to display: Paid Thru Date: 4/1/2022...
    I can't quite figure out how to get it to convert that 44652 back to the 4/1/2022 inside of the appended formula

    1. Hello!
      To display the date as text, use the TEXT function when concatenating values.
      Please check the formula below, it should work for you:

      ="Paid Thru Date: "&TEXT(Y2,"m/d/yyyy")

      1. Awesome - Thank you so much!

  39. Hey! :)
    I see you explained how to go from an 8 digit number to a date, is it possible to do it the other way around? I need to generate a specific 8-digit code for every test I do, and connect it to the specific date. In some instances, I run more than one test a day so I need to add an extra digit at the end. Eg: on 10.11.2022 I run 3 tests and I need to convert the date to 101120221, 101120222 and 101120223, or even more ideally to a six digit + 1 (1011221, 1011222, 1011223)
    I would appreciate your help

    1. Hello!
      To count the number of matching dates, use the COUNTIF function.
      You can convert a date to a number using the TEXT function and the "ddmmyy" format.

      =IF(COUNTIF($A$1:$A$100,A1)=1, TEXT(A1,"ddmmyy"), TEXT(A1,"ddmmyy")&COUNTIF($A$1:A1,A1))

      Copy this formula down along the column.
      Hope this is what you need.

      1. Thank you for your help.

  40. how can I calculate a month like "January" into Days

  41. Trying to convert text to dates: example : 15-01-1749 (old church records from the 1500's to 1900's)
    Used this formula, like your example:
    =DATE(RIGHT(B14,4),MID(B14,4,2),LEFT(B14,2))

    It returned: 15-Jan-3649

    All of the day/months are correct, but all the years are off by 1900 years.
    What am I doing wrong? Thank you for your help.
    Ann

    1. Hello!
      Excel does not work with dates prior to 1900. If the year number is between 0 and 1899 inclusive, Excel calculates the year by adding that number to 1900.

      1. Thank you - I thought I was losing my mind!
        Trying to think of a workaround. I can make value combined with the right function to turn the year into a number in a new column, and then just display the m/d in a separate column. Is that the best I can do?
        Would any of the date functions in Ablebits help me with this?

        I'm taking data from Family Tree Maker for church parishes with birth, marriage and death dates, with other text fields, so I need to be able to play with different sorts to come up with birth rates, causes of death over time, and other statistical info. Lots of calendar math needed. There are between 7-17k records in each of the 3 parishes.

        Once again, thank your for your help,
        Ann

        1. Hello!
          Extract the year from the date using the YEAR function and write the correct year in a separate cell by subtracting 1900.

          YEAR(DATE(RIGHT(B14,4),MID(B14,4,2),LEFT(B14,2)))-1900

  42. In A1 i have 1984 B1 i have Apple
    A2 I have Jun-1990 B2 i have Orange
    A3 i have 01-May-2020 B3 I have Grape

    i need to join the text as in C1 =Apple (1984)
    C2 =Orange (Jun-1990)
    C3 = Grape (01-May-2020)
    Used text function its not working for C1.

    Please help me in resolving this issue

      1. i have year as 1984 in A1, and 28-Feb-18 in A2,

        if use text to convert it date, 1984 comes as 07-Jul-1909, A2 comes as 28-Feb-2018 correctly, but i need it 1984 as 1984 only instead of 07-Jul-1909.

        1. Hi!
          How can I help if you do not answer my questions and the problem description is completely unclear?

  43. Is it possible determine the number of days from a month text such as "August"

    Many thanks

    1. Hello!
      Convert text to date and determine the first day of the month using the DATEVALUE function. Determine the last day of the month using the EOMONTH function. Find the difference between dates and add 1 day.
      Please check the formula below, it should work for you:

      =EOMONTH(DATEVALUE(1&A1),0)-DATEVALUE(1&A1)+1

  44. Hey,

    I need to covert 20200818 (Aug 18 - 2020) to be 08/18/2020 (mm/dd/yyyy) using a single formula!
    Please help!

    1. Hi!
      Pay attention to the following paragraph of the article above – How to convert 8-digit number to date in Excel.
      It covers your case completely.

  45. How could I convert this to date? JAN01/19
    I'd be forever grateful!

  46. I have two strings.
    #1: 72222 and need it to be 7/22/22
    #2: 120121 and need it to be 12/1/21

    Thank you!

  47. hello
    i have a set of text 551231-02-4556 in which i would extract the first 6 character to be converted to date value result to be 31-12-1955

    any solution to this?
    Thank you

      1. Thank you very much, it works, great.

  48. Hello, Mr. Alexander.. Is there a way to swap the data and month VALUE? Not just the formatting. When I paste date values from a text file or PDF, Excel auto-interprets the values incorrectly. I.e. 02-03-2019 is imported as 03rd Feb instead of 02nd Mar. Simply changing the formatting does not fix this problem.

  49. I have date formatted field(12/20/1984) in excel, when i am saving data as xml. Date is converted to number. What i need to do in excel to save this as date. I used below custom validation to allow field string(Delete) and date

    =OR(AND(ISNUMBER(J3),LEFT(CELL("format",J3),1)="D"),J3="Delete")

    1. Hi!
      Excel stores the date as a number. The .xml format does not have a date format. Save the file as an Excel file (.xlsx) and then you can write the date as a date, not as a number.

      1. Final data I need in XML . I am not clear on statement - Save the file as an Excel file (.xlsx) and then you can write the date as a date, not as a number. Can you give me one example.

          1. Thank You Alex.

  50. How do I convert this date

    Jan-01-1985 TO 1985-01-01

    1. Hello!
      To convert text to date, extract the desired characters using the substring functions.

      =DATE(MID(A1,FIND("~",SUBSTITUTE(A1,"-","~",2),1)+1,4), VLOOKUP(LEFT(A1,3), {"JAN",1;"FEB",2;"MAR",3;"APR",4;"May",5;"JUN",6;"JUL",7;"AUG",8;"Sep",9;"OCT",10;"NOV",11;"DEC",12},2,0), MID(A1,FIND("-",A1,1)+1,2))

      Then use DATE function. Set the cell to the custom date format that you need. For example, "yyyy-mm-dd".

      To convert text to date, you can also use the Text to Date tool.
      It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)