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 number 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.

Since Excel is not the only application you work with, sometimes you'll find yourself working with dates imported in an Excel worksheet from a .csv file or another external source. When that happens, chances are the dates will export as text entries. Even though they look like dates, Excel won't not recognize them as such.

There are many ways to convert text to date in Excel and this tutorial aims to cover them all, so that you can choose a text-to-date conversion technique most suitable for your data format and your preference for a formula or non-formula way.

How to distinguish normal Excel dates from "text dates"

When importing data into Excel, there is often a problem with date formatting. The imported entries may look like normal Excel dates to you, but they don't behave like dates. Microsoft Excel treats such entries as text, meaning you cannot sort your table by date properly, nor can you use those "text dates" in formulas, PivotTables, charts or any other Excel tool that recognizes dates.

There are a few signs that can help you determine whether a given entry is a date or a text value.

Dates Text values
  • Right-aligned by default.
  • Have Date format in the Number Format box on the Home tab > Number.
  • If several dates are selected, the Status Bar shows Average, Count and SUM.
  • Left-aligned by default.
  • General format displays in the Number Format box on the Home tab > Number.
  • If several text dates are selected, the Status Bar only shows Count.
  • There may be a leading apostrophe visible in the formula bar.

How to distinguish dates from text strings in Excel

How to convert number to date in Excel

Since all Excel functions that change text to date return a number as a result, let's have a closer look at converting numbers to dates first.

As you probably know, Excel stores dates and times as serial numbers and it is only a cell's formatting that forces a number to be displayed as a date. For example, 1-Jan-1900 is stored as number 1, 2-Jan-1900 is stored as 2, and 1-Jan-2015 is stored as 42005. For more information on how Excel stores dates and times, please see Excel date format.

When calculating dates in Excel, the result returned by different date functions is often a serial number representing a date. To convert such serial number to date in Excel, all you have to do is change the cell formatting. For this, select a cell or a range of cells with the numbers you want to convert to dates and press Ctrl+1 to open the Format Cells dialog. On the Number tab, choose Date, select the desired date format under Type and click OK.
Converting numbers to dates in Excel

Yep, it's that easy! If you want something more sophisticated than predefined Excel date formats, please see how to create a custom date format in Excel.

If some stubborn number refuses to change to a date, check out Excel date format not working - troubleshooting tips.

How to convert 8-digit number to date in Excel

It's a very common situation when a date is input as an 8-digit number like 10032016, and you need to convert it into a date value that Excel can recognize (10/03/2016). In this case, simply changing the cell format to Date won't work - you will get ########## as the result.

To convert such a number to date, you will have to use the DATE function in combination with RIGHT, LEFT and MID functions. Unfortunately, it is not possible to make a universal formula that will work in all scenarios because the original number can be input in a variety of different formats. For example:

Number Format Date
10032016 ddmmyyyy 10-Mar-2016
20160310 yyyymmdd
20161003 yyyyddmm

Anyway, I will try to explain the general approach to converting such numbers to dates and provide a few formula examples.

For starters, remember the order of the Excel Date function arguments:

=DATE(year, month, day)

So, what you need to do is extract a year, month and date from the original number and supply them as the corresponding arguments to the Date function.

For example, let's see how you can convert number 10032016 (stored in cell A1) to date 3/10/2016.

  • Extract the year. It's the last 4 digits, so we use the RIGHT function to pick the last 4 characters: RIGHT(A1, 4).
  • Extract the month. It's the 3rd and 4th digits, so we employ the MID function to get them MID(A1, 3, 2). Where 3 (second argument) is the start number, and 2 (third argument) is the number of characters to extract.
  • Extract the day. It's the first 2 digits, so we have the LEFT function to return the first 2 characters: LEFT(A2,2).

Finally, embed the above ingredients into the Date function, and you get a formula to convert number to date in Excel:

=DATE(RIGHT(A1,4), MID(A1,3,2), LEFT(A1,2))

The following screenshot demonstrates this and a couple more formulas in action:
Converting number to date in Excel

Please pay attention to the last formula in the above screenshot (row 6). The original number-date (161003) contains only 2 chars representing a year (16). So, to get the year of 2016, we concatenate 20 and 16 using the following formula: 20&LEFT(A6,2). If you don't do this, the Date function will return 1916 by default, which is a bit weird as if Microsoft still lived in the 20th century :)

Note. The formulas demonstrated in this example work correctly as long as all numbers you want to convert to dates follow the same pattern.

How to convert text to date in Excel

When you spot text dates in your Excel file, most likely you would want to convert those text strings to normal Excel dates so that you can refer to them in your formulas to perform various calculations. And as is often the case in Excel, there are a few ways to tackle the task.

Excel DATEVALUE function - change text to date

The DATEVALUE function in Excel converts a date in the text format to a serial number that Excel recognizes as a date.

The syntax of Excel's DATEVALUE is very straightforward:

=DATEVALUE(date_text)

So, the formula to convert a text value to date is as simple as =DATEVALUE(A1), where A1 is a cell with a date stored as a text string.

Because the Excel DATEVALUE function converts a text date to a serial number, you will have to make that number look like a date by applying the Date format to it, as we discussed a moment ago.

The following screenshots demonstrates a few Excel DATEVALUE formulas in action:
Convert text to date using the Excel DATEVALUE function.

Excel DATEVALUE function - things to remember

When converting a text string to a date using the DATEVALUE function, please keep in mind that:

  • Time information in text strings is ignored, as you can see in rows 6 and 8 above. To convert text values containing both dates and times, use the VALUE function.
  • If the year is omitted in a text date, Excel's DATEVALUE will pick the current year from your computer's system clock, as demonstrated in row 4 above.
  • Since Microsoft Excel stores dates since January 1, 1900 , the use of the Excel DATEVALUE function on earlier dates will result in the #VALUE! error.
  • The DATEVALUE function cannot convert a numeric value to date, nor can it process a text string that looks like a number, for that you will need to use the Excel VALUE function, and this is exactly what we are going to discuss next.

Excel VALUE function - convert a text string to date

Compared to DATEVALUE, the Excel VALUE function is more versatile. It can convert any text string that looks like a date or number into a number, which you can easily change to a date format of your choosing.

The syntax of the VALUE function is as follows:

=VALUE(text)

Where text is a text string or reference to a cell containing the text you want to convert to number.

The Excel VALUE function can process both date and time, the latter is converted to a decimal portion, as you can see in row 6 in the following screenshot:
Using the Excel VALUE function to convert a text string to date

Mathematical operations to convert text to dates

Apart from using specific Excel functions such as VALUE and DATEVALUE, you can perform a simple mathematical operation to force Excel to do a text-to-date conversion for you. The required condition is that an operation should not change the date's value (serial number). Sounds a bit tricky? The following examples will make things easy!

Assuming that your text date is in cell A1, you can use any of the following formulas, and then apply the Date format to the cell:

  • Addition: =A1 + 0
  • Multiplication: =A1 * 1
  • Division: =A1 / 1
  • Double negation: =--A1

Converting text to dates via mathematical operations

As you can see in the above screenshot, mathematical operations can convert dates (rows 2 and 4), times (row 6) as well as numbers formatted as text (row 8). Sometimes the result is even displayed as a date automatically, and you don't have to bother about changing the cell format.

How to convert text strings with custom delimiters to dates

If your text dates contain some delimiter other than a forward slash (/) or dash (-), Excel functions won't be able to recognize them as dates and return the #VALUE! error.

To fix this, you can run Excel's Find and Replace tool to replace your delimiter with a slash (/), all in one go:

  • Select all the text strings you want to convert to dates.
  • Press Ctrl+H to open the Find and Replace dialog box.
  • Enter your custom separator (a dot in this example) in the Find what field, and a slash in the Replace with
  • Click the Replace All

Replacing a custom delimiter with a slash

Now, the DATEVALUE or VALUE function should have no problem with converting the text strings to dates. In the same manner, you can fix dates containing any other delimiter, e.g. a space or a backward slash.

If you prefer a formula solution, you can use Excel's SUBSTITUTE function instead of Replace All to switch your delimiters to slashes.

Assuming the text strings are in column A, a SUBSTITUTE formula may look as follows:

=SUBSTITUTE(A1, ".", "/")

Where A1 is a text date and "." is the delimiter your strings are separated with.

Now, let's embed this SUBSTITUTE function into the VALUE formula:

=VALUE(SUBSTITUTE(A1, ".", "/"))

And have the text strings converted to dates, all with a single formula.

Converting text strings with custom delimiters to dates

As you see, the Excel DATEVALUE and VALUE functions are quite powerful, but both have their limits. For example, if you are trying to convert complex text strings like Thursday, January 01, 2015, neither function could help. Luckily, there is a non-formula solution that can handle this task and the next section explains the detailed steps.

Text to Columns wizard - formula-free way to covert text to date

If you are a non-formula user type, a long-standing Excel feature called Text To Columns will come in handy. It can cope with simple text dates demonstrated in Example 1 as well as multi-part text strings shown in Example 2.

Example 1. Converting simple text strings to dates

If the text strings you want to convert to dates look like any of the following:

  • 1.1.2015
  • 1.2015
  • 01 01 2015
  • 2015/1/1

You don't really need formulas, nor exporting or importing anything. All it takes is 5 quick steps.

In this example, we will be converting text strings like 01 01 2015 (day, month and year are separated with spaces) to dates.

  1. In your Excel worksheet, select a column of text entries you want to convert to dates.
  2. Switch to the Data tab, Data Tools group, and click Text to Columns.
    Switch to the Data tab and click Text to Columns.
  3. In step 1 of the Convert Text to Columns Wizard, select Delimited and click Next.
    In step 1 of the Convert Text to Columns Wizard, select Delimited and click Next.
  4. In step 2 of the wizard, uncheck all delimiter boxes and click Next.
    On step 2, uncheck all delimiter boxes and click Next.
  5. In the final step, select Date under Column data format, choose the format corresponding to your dates, and click Finish.

In this example, we are converting the text dates formatted as "01 02 2015" (month day year), so we select MDY from the drop down box.
Choose the format corresponding to your dates, and click Finish.

Now, Excel recognizes your text strings as dates, automatically converts them to your default date format and displays right-aligned in the cells. You can change the date format in the usual way via the Format Cells dialog.

Note. For the Text to Column wizard to work correctly, all of your text strings should be formatted identically. For example, if some of your entries are formatted like day/month/year format while others are month/day/year, you would get incorrect results.

Example 2. Converting complex text strings to dates

If your dates are represented by multi-part text strings, such as:

  • Thursday, January 01, 2015
  • January 01, 2015 3 PM

You will have to put a bit more effort and use both the Text to Columns wizard and Excel DATE function.

  1. Select all text strings to be converted to dates.
  2. Click the Text to Columns button on the Data tab, Data Tools group.
  3. On step 1 of the Convert Text to Columns Wizard, select Delimited and click Next.
  4. On step 2 of the wizard, select the delimiters your text strings contain.

    For example, if you are converting strings separated by commas and spaces, like "Thursday, January 01, 2015", you should choose both delimiters - Comma and Space.
    Select the delimiters your text strings contain.

    It also makes sense to select the "Treat consecutive delimiters as one" option to ignore extra spaces, if your data has any.

    And finally, have a look at the Data preview window and verify if the text strings are split to columns correctly, then click Next.

  5. On step 3 of the wizard, make sure all columns in the Data Preview section have the General format. If they don't, click on a column and select General under the Column data format options.
    Note. Do not choose the Date format for any column because each column contains only one component, so Excel won't be able to understand this is a date.

    If you don't need some column, click on it and select Do not import column (skip).

    If you don't want to overwrite the original data, specify where the columns should be inserted - enter the address for the top left cell in the Destination field.

    When done, click the Finish button.
    Make sure all columns have the General format and choose where to insert the columns.

    As you see in the screenshot above, we are skipping the first column with the days of the week, splitting the other data into 3 columns (in the General format) and inserting these columns beginning from cell C2.

    The following screenshot shows the result, with the original data in column A and the split data in columns C, D and E.

    Text strings are split into 3 different columns.

  6. Finally, you have to combine the date parts together by using a DATE formula. The syntax of the Excel DATE function is self-explanatory:

    =DATE(year, month, day)

    In our case, year is in column E and day is in column D, no problem with these.

    It's not so easy with month because it is text while the DATE function needs a number. Luckily, Microsoft Excel provides a special MONTH function that can change a month's name to a month's number:

    =MONTH(serial_number)

    For the MONTH function to understand it deals with a date, we put it like this:

    =MONTH(1&C2)

    Where C2 contains the name of the month, January in our case. "1&" is added to concatenate a date (1 January) so that the MONTH function can convert it to the corresponding month number.

    And now, let's embed the MONTH function into the month; argument of our DATE formula:

    =DATE(F2,MONTH(1&D2),E2)

And voila, our complex text strings are successfully converted to dates:
The text strings are successfully converted to dates.

Quick conversion of text dates using Paste Special

To quickly convert a range of simple text strings to dates, you can use the following trick.

  • Copy any empty cell (select it and press Ctrl + C).
  • Select the range with text values you want to convert to dates.
  • Right-click the selection, click Paste Special, and select Add in the Paste Special dialog box:
    Quick conversion of text dates using Paste Special
  • Click OK to complete the conversion and close the dialog.

What you have just done is tell Excel to add a zero (empty cell) to your text dates. To be able to do this, Excel converts a text string to a number, and since adding a zero does not change the value, you get exactly what you wanted - the date's serial number. As usual, you change a number to the date format by using the Format Cells dialog.

To learn more about the Paste Special feature, please see How to use Paste Special in Excel

Fixing text dates with two-digit years

The modern versions of Microsoft Excel are smart enough to spot some obvious errors in your data, or better say, what Excel considers an error. When this happens, you will see an error indicator (a small green triangle) in the upper-left corner of the cell and when you select the cell, an exclamation mark appears:
Error indicators in Excel

Clicking the exclamation mark will display a few options relevant to your data. In case of a 2-digit year, Excel will ask if you want to convert it to 19XX or 20XX.

If you have multiple entries of this type, you can fix them all in one fell swoop - select all the cells with errors, then click on the exclamation mark and select the appropriate option.
Fixing text dates with two-digit years using Excel Error Checking

How to turn on Error Checking in Excel

Usually, Error Checking is enabled in Excel by default. To make sure, click File > Options > Formulas, scroll down to the Error Checking section and verify if the following options are checked:

  • Enable background error checking under Error Checking;
  • Cells containing years represented as 2 digits under Error checking rules.

Turning on Error Checking in Excel

This is how you convert text to date in Excel and change dates to text. Hopefully, you have been able to find a technique to your liking. In the next article, we will tackle the opposite task and explore different ways of converting Excel dates to text strings. I thank you for reading and hope to see you next week.

You may also be interested in

364 responses to "How to convert text to date and number to date in Excel"

  1. Richard says:

    Hi,
    Good day!
    Could someone help me covert these,
    Example:
    1170217 to 17 Feb 2017,
    1180816 to 16 Aug 2018,
    930524 to 24 May 1993

    Thanks

    • Hello Richard!
      If I understand your task correctly, the following formula should work for you:

      =DATE(IF (LEN(A1)=7,"20" & MID(A1,LEN(A1)-5,2), MID(A1,LEN(A1)-5,2)), MID(A1, LEN(A1)-3,2), RIGHT(A1,2))

      Please go to Format Cells, choose Number -> Custom Format and set
      dd mmm yyyy
      I hope it’ll be helpful.

  2. Nitin Chitnis says:

    I have a Problem.In Excel CellS5=IF(G5="","",">="&G5)this formula,when i enter a date in G5 as 01/04/20 the cell S5 shows the result as >=43922.What to do? Please help me.Thanks.

  3. Max says:

    We need to have formula to convert text to date using specified format - in the same manner as TEXT function works.

  4. Henry says:

    Hi, I have dates input as a continuous number - yyyymmdd and I would like to have it as a date - ddmmyyyy.
    For example, I have 20180808 in cell D2 - I was trying the following formula based on the above guidelines. Could you tell me where I'm going wrong?
    =DATE(LEFT(D2,4), MID(D2,5,2), RIGHT(D2,2))
    Thanks

    • Hello Henry!
      To convert a number to a date, you must first convert it to text.
      Please try the following formula:

      =DATEVALUE(LEFT(TEXT(D1,"###"),4)&"-"&MID(TEXT(D1,"###"),5,2)&"-"&RIGHT(TEXT(D1,"###"),2))

      Then go to Format Cells, choose Number -> Date and set format you need.
      Hope you’ll find this information helpful.

  5. Matt says:

    What formula would work to convert two separate date headers into one and then converting them into the MM/DD/YYYY format? In the example below I have the birthday in column "E" and and birth year in column "F". I think ideally I would merge that to show January 20th, 1930 in one column and then change the format after. I tried concatenating those two and then format cells --> date but it wouldn't let me change the date that way.
    Example:
    Birthday Birth Year
    January 20th 1930

  6. FURQAN says:

    how can i convert below number into Date
    1052019
    Basically it 05th of October 2019 but i need to convert into proper date format so can you help me out to solve this issue.

    • Hello FURQAN,
      Please try the following formula:

      =DATE(RIGHT(TEXT(A1,"###"),4), LEFT(A1,LEN(TEXT(A1,"###"))-5), MID(TEXT(A1,"###"), LEN(TEXT(A1,"###"))-5,2))

      however, the date of October 15, recorded as 10152019, this formula will not calculate correctly.

      it is necessary that the day is always written as a two-digit number, for example, October 5 as 10052019. Then you can use this formula:

      =DATE(RIGHT(TEXT(A1,"###"),4), LEFT(A1,LEN(TEXT(A1,"###"))-6), MID(TEXT(A1,"###"),LEN(TEXT(A1,"###"))-5,2))

      I hope it’ll be helpful.

  7. Stan says:

    I’m having a small issue with a formula not always working.
    When I use =SUM(IF(F4>G4,F4-G4,G4-F4)) in cell F6, it does not always calculate correctly. So
    if F4 is 04/08/2020 09:18:00 PM and G4 is 04/08/2020 09:10:00 PM it returns 0:08:00 which is correct. But on the next line of if F5 is 04/09/2020 07:00:00 PM and G5 is 04/09/2020 09:49:00 AM i get ######################. Both F4 and F5 are formatted for date and time, while F6 is formatted for time.

    • Hello Stan!
      I am sorry, it is difficult to say what may be the cause of the issue based only on your description. As far as I can see, you do not use cells G5 and F5 in your formula. Besides, you work only with one row so the SUM function is not necessary here. Might it has happened that you have written the formula incorrectly?
      I will try to be an extrasensory expert and suppose that you want to use the following formula:

      =SUM(IF(F4:F5 > G4:G5, F4:F5-G4:G5, G4:G5-F4:F5))

      If this is not what you need, please clarify your calculations so that I will help you better.

  8. Allan says:

    Just some clarity, I want know if Excel can automatically detect a new place and automatically the dates change to that country from the way you entered them while in your country

  9. Barbara says:

    Hi,

    Can someone please help me with converting text to date e.g 7111978. I tried using converting text to date. I followed the steps but still not getting anywhere.

  10. Barbara says:

    How do you convert this kind of text to date? For example, 7111978, 3151980. I tried using the convert text to date but I am not getting anywhere.

    Thank you

    • Hello Barbara!
      The formula with which you can convert tex to date, I wrote above for you. Please note that in order for this formula to always work, the number of digits in the month number must always be 2.
      If you, for example, have written 1112019. How can the formula determine whether it is November 1 or January 11?

  11. Cadi says:

    Hi,

    I want advice on a formula please, I want to to generate a future date 6 months in the future to be calculated from a start date and a word, so for example: the first date would be in one column, the word high in the next column would generate a future date 6 months on, but only generated when the word high is in the second column
    01/01/2020 High 01/06/2020

    Thank you

  12. Dilan says:

    Hello,
    I want to convert 4 digit number to date
    Example "0204" to date 02/04/2020.

  13. Arni says:

    Hi Alexander,
    How I can convert the below date with time to date only dd/mm/yy?
    2019-11-13 07:10:24.858757 -> dd/mm/yy
    Best Regards

    • Arni says:

      Sorted now.

    • Hello Arni,
      If you want to change the appearance of the cell, but not change its content, use the Custom Format. Please go to Format Cells, choose Number -> Custom Format and set format dd/mm/yy.

      If you want to remove the time value from the date, then use the formula that will refer to this cell

      =DATEVALUE(TEXT(D1,"mm/dd/yy hh:mm:ss"))

      where mm/dd/yy - is system date format.

      Check what date format you have installed on Windows. Go to Control Panel – Time – Region Settings – Change data formats
      I hope this will help, otherwise please do not hesitate to contact me anytime.

  14. bhawneet says:

    Hello sir
    i have a huge excel file in notepad format when i convert it to excel and after applying text to column some date shows as text and swap date and month

    17/03/2020 (ok)
    03/07/2015(converted to text, but actual date is 07/03/2015)
    29/01/2015 (ok)
    29/01/2015 (ok)
    29/01/2015 (ok)
    27/03/2019 (ok)
    24/08/2015 (ok)
    16/05/2018 (ok)
    02/07/2015 (converted to text, but actual date is 07/03/2015)
    02/07/2015(converted to text, but actual date is 07/03/2015)
    like this
    how can i covert all into once with correct format

    best regards

  15. Tim says:

    Hey Alexander,

    I'm trying to get a formula to turn "May 29th 2020, 23:58:18:000" (which comes in from an export file as a general format in a .csv excel sheet), into "2020-05-29" in one cell and "23:58:18" in a different cell both formatted into a date so that it can be filtered via pivot charts through the year, month, day, and time of day.

    I've tried a few different ways of doing this already, but am unable to get the formatting to work correctly, any suggestions?

    Thanks in advance, you seem very knowledgeable in excel!

    • Hello Tim!
      If I understand your task correctly, the following formulas should work for you

      =DATEVALUE(MID(A10,SEARCH(" ",A10,1)+1, SEARCH("th",A10,1) -SEARCH(" ",A10,1)-1)&" "&LEFT(A10,SEARCH(" ",A10,1)-1) &MID(A10,SEARCH(",",A10,1)-5,5))

      and

      =TIMEVALUE(REPLACE(MID(A10,SEARCH(",",A10,1)+2,50), LEN(MID(A10,SEARCH(",",A10,1)+2,50))-4,4,""))

      I hope this will help, otherwise please do not hesitate to contact me anytime.

  16. Satish says:

    hi,
    How Do to convert this text(250220) into date format(12-Feb-2020).
    250220 - DDMMYY to DDMMYYYY
    look forward your support
    regards
    satish

    • If your system date format is DD-MM-YY, then you can use the formula to turn text into a date

      =DATEVALUE(TEXT(D1,"##-##-##"))

      The second version of the formula

      =DATE("20"&RIGHT(D1,2),MID(D1,3,2),LEFT(D1,2))

      I hope this will help, otherwise please do not hesitate to contact me anytime.

  17. Anurag says:

    Sir,

    If my date is in this format 05-17-2020 so tell me which for i use for change the format in dd-mm-yyyy

    • Hello!
      If I understand correctly, you want to change the date format.
      Check what date format you have installed on Windows. Go to Control Panel – Time – Region Settings – Change data formats
      If you do not want to change the date format for all files, use the second method.
      Please go to Format Cells, choose Number -> Custom Format and set
      dd-mm-yyyy

      I hope this will help, otherwise please do not hesitate to contact me anytime.

  18. Sangeet230 says:

    Hi there!
    I have a narration in cell D2 like so "ELECTRICITY CHARGES Bill for the month of April 2019".

    Is there a formula which would return just the month i.e. "April"? I want to be able to use that for a pivot.

    • Hello!
      To extract the penultimate word from the text, use the formula

      =MID(A1,FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-1- LEN(SUBSTITUTE(A1," ",""))),1)+1, FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)- LEN(SUBSTITUTE(A1," ",""))),1)- FIND("*",SUBSTITUTE(A1," ","*", LEN(A1)-1-LEN(SUBSTITUTE(A1," ",""))),1)-1)

      Hope this is what you need.

  19. Adam says:

    How do I convert Date A's format to Date B's format?

    Date A: 9/25/2019 21:52
    Date B: 01-07-2020 3:59:00 AM

  20. kellie says:

    how to convert date to text

  21. Jacob says:

    You might want to mention in bold somewhere that Excel is heavily dependent on Regional settings in our Windows PC. Two people might see completely different results based on regional settings. One of my colleagues in another part of the world was seeing #VALUE! using my Excel sheet which was displaying fine for me. The culprit - Date format in Windows region settings!! Took hours to figure out.

  22. YD Forums says:

    I have used the DATEVALUE function in the past and it works fie for me when the date string is in d/m/yyyy format. Now I received files files with the date in m/d/yyyy format and the function is returning an error. I'm guessing that DATEVALUE expects the string date format to be per Windows region settings, or some setting in Excel. Is there a way to "tell" DATEVALUE what the date string format is?
    I am using Excel 2007 under Win 10-64.

    • Hello!
      You need to change the date string according to the regional format of Windows. Use something like this for the DATEVALUE function

      =DATEVALUE(MID(B11,SEARCH("/",B11,1)+1,SEARCH("/",B11,SEARCH("/",B11,1)+1)-SEARCH("/",B11,1)-1) & "/"&LEFT(B11,SEARCH("/",B11,1)-1) & "/"&RIGHT(B11,4))

      Instead of the format m/d/yyyy you get d/mm/yyyy

      I hope this will help, otherwise please do not hesitate to contact me anytime.

  23. Tram Bui says:

    Good morning,
    Could you please advise how could I convert data "202001" to JAN-20?
    Thank you in advance!

    • Hello!
      If you want to convert data to a date, use the formula

      =DATEVALUE(RIGHT(A20,2)&"/1/"&LEFT(A20,4))

      and then apply a custom format

      Mm-yy

      To convert data to text as a date, use the formula

      =VLOOKUP(--RIGHT(A20,2), {1,"JAN";2,"FEB";3,"MAR";4,"APR";5,"MAY";6,"JUN";7,"JUL";8,"AUG";9,"SEP";10,"OCT";11,"NOV";12,"DEC"}, 2,0)&"-"&MID(A20,3,2)

      Hope this is what you need.

  24. Shai says:

    Hi! How can I convert 20th Mar 2020 into 20/03/2020 format? I've tried all the above suggestion but it still not working. Thanks!

  25. Mel says:

    Hi, Can you help me turn an identification into a date? I have a person's initial followed by their DOB, and want a column that reads just the DOB. For example, AB010107 to 1/1/07.

    • Mel says:

      Also the date format I want is month/day/year.

      • Too bad you didn't say that before

        =DATEVALUE(CONCATENATE(MID(CONCAT(IF(ISNUMBER(--MID(A1,ROW($1:$93),1)), MID(A1,ROW($1:$93),1),"")),3,2),"/", LEFT(CONCAT(IF(ISNUMBER(--MID(A1,ROW($1:$93),1)), MID(A1,ROW($1:$93),1),"")),2),"/", RIGHT(CONCAT(IF(ISNUMBER(--MID(A1,ROW($1:$93),1)), MID(A1,ROW($1:$93),1),"")),2)))

    • Hello Mel!
      Extract numbers from text. Then convert these numbers to a date.

      =DATEVALUE(CONCATENATE(LEFT(CONCAT(IF(ISNUMBER(--MID(A1,ROW($1:$93),1)), MID(A1,ROW($1:$93),1),"")),2),"/", MID(CONCAT(IF(ISNUMBER(--MID(A1,ROW($1:$93),1)), MID(A1,ROW($1:$93),1),"")),3,2),"/", RIGHT(CONCAT(IF(ISNUMBER(--MID(A1,ROW($1:$93),1)), MID(A1,ROW($1:$93),1),"")),2)))

      Remember to apply the date format to the cell with the formula.

  26. Max says:

    Hello,
    I'm trying to convert text to dates from text that has a variable number of digits i.e.

    28042020 = 28/04/2020
    29042020 = 29/04/2020
    4052020 = 4/05/2020
    5052020 = 5/05/2020

    Is there a formula that will recognise that there is a digit missing (the "0")?

  27. Avinash says:

    Glad to see that you have replied to almost all queries. I have tried to follow many options that have been provided but unable to get the text into date format. I have this number in text format that in reality is last-logged in date & time stamp in source system. When retrieved it comes as text as 132374551396990975
    How can i format it into date or date & time stamp.

  28. harsh says:

    I took out an output from some tool which gave me the numeric value of the datetime -
    June 25, 2020 16:06:37 as 1593065197208, when i exported it in csv.
    i am not sure what 1593065197208 is and how to convert it back to

    • harsh says:

      ** correction **
      convert it to June 25, 2020 16:06:37 in excel. Can you please explain what that number is and how to convert it.
      Thanks in Advance.

  29. Prashanth says:

    I have two columns with date and time stamp as strings ex. June-23-2020 12:38:42 PM.
    First I want to convert these to normal date and time format so that I can find time different between two columns. Please suggest.

    • Hello!
      To select a date from your text, use the formula

      =DATEVALUE(MID(Z1,FIND(" ",Z1,1)-4,4)&"-" &MATCH(LEFT(Z1,3),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}) &"-"&MID(Z1,FIND(" ",Z1,1)-7,2))
      To select time from the text, use the formula

      =TIMEVALUE(RIGHT(Z1,LEN(Z1)-FIND(" ",Z1,1)))

      Hope this is what you need.

  30. Sandra says:

    Hi,
    I need to convert dates in the following format - MMYY - from TEXT to DATE format. The dates are entered as follows:
    114 for 01/1/2014
    1015 for 10/1/2015
    616 for 06/1/2016
    The day is always understood to be 1 so it is never entered. The year is always understood to start with 20 so it is never entered. Zeros are never entered in front of single-digit months.
    Do you have a formula to convert?
    Any help would be appreciated!

  31. Shruthi says:

    Hi Alexander,

    I need to convert YYYYMMDD to MMDDYY for all the cells is it possible. Please help

    • Hello Shruthi!
      I’m sorry but your task is not entirely clear to me. Could you please describe it in more detail? Is your data recorded as a date or as text? Do you want to get the result as a date or as text? Write an example of the source data and the result you want to get.

  32. Soph says:

    Hello, I want to put 3 reminder dates at least in one cell, and then used those dates to determine the last activity date of all dates in my sheet, meaning there would be different cells selected which will have one single date. Formating for reminder dates would be (01/06/2020 (alt+enter) 06/06/2020 (alt+enter) 12/06/2020)

  33. AA says:

    Hi!
    I have a question, I wanted to get a continuous string of yyyymmm, but if I do it I get something like 201913. For example, I started off with date 201906, and I wanted that to keep going into 202006 without me having to change the 201913, 201914, 201915 etc. Is there a way to do this? For my formula I just do the cell+ 1, which is why i get the 201913.

    Thank you!

  34. Shri says:

    Hello,

    How to convert 2020-04-17T10:58:58Z to DD/MM/YYYY
    Thank You

  35. Dan Mike says:

    Hi. Previously, if I type "8-10" it would be treated as mmdd resulting to "Aug-10" or depending on default format. Now, excel treats "8-10" as ddmm and shows October-08. Is there a way to change the default syntax of typing dates without having to change the date format every new excel worksheet?

  36. Becky says:

    Hello
    How do i please convert this "40464% order date in cell C2 into a normal date format

  37. OneJ says:

    Thank you so much for this! This is very helpful!

  38. Abhi says:

    Hi Alexander
    Please help to convert
    8/19/2020 7:37:23 PM in General to 19-08-2020 19:37

  39. Linda says:

    I have imported data from our school information system. Birthdays are showing as 8/20/2002. I need the format to be a text before I can upload the file to another system. The format has to be in mmddyyyy, which I have done so my cell now shows 08202002, but I need it to be recognized as text, not a date before I upload it. If I try to convert it to text, it shows the number 37498, which I understand is the number of days since Jan. 1 1900. How do I get the cell to recognize 08202002 as text and no longer as a date? If I upload it as it is showing, I receive an error stating my date is in the wrong format, because it is still showing as a date not a number.
    Thank you.

  40. Grace says:

    How do I covert this number to a date - Month/Day/Year
    I tried this formula and it does not work.
    =DATE(RIGHT(A2,4), MID(A2,3,2), LEFT(A21,2)) 1/6/2020
    Posting Date Transaction Date
    06012020 05292020
    06012020 05282020
    06012020 05292020

  41. stephen says:

    I cannot do calculation with "9/25/2019 12:00:00 AM". It seems it is text. How can I convert it to "Sep 25 2019"? I want to do a subtraction with another cell in that format to get the days in between.

    • Hello!
      If your date is written as text, you can convert it to a real date using the formula

      =DATE(MID(E1,FIND("~",SUBSTITUTE(E1,"/","~",2),1)+1,FIND(" ",E1,1) - FIND("~",SUBSTITUTE(E1,"/","~",2),1)-1), LEFT(E1, SEARCH("/",E1,1)-1), MID(E1,FIND("~",SUBSTITUTE(E1,"/","~",1),1)+1, FIND("~",SUBSTITUTE(E1,"/","~",2),1) - FIND("~",SUBSTITUTE(E1,"/","~",1),1)-1))

      Then set the date format you want in the cell.

  42. Daniel says:

    Dear sirs, can I ask for a wee bit of your expertise since my own is not enough in this case?

    I am looking to do comparisons between quarters during the year but with the closing balance date fixed from previous year. Let me explain:
    E.g. QUARTER 4(b)=2020-12-31, QUARTER 3(c)=2020-09-30, Closing balance (QUARTER 4(a))=2019-12-31.
    I have created formulas for Q4(b) and Q3(c) (linked to another date cell) respecively so that when Q4(b)=>Q1(b), Q3(c)=>Q4(c). But, i want the Closing balance date Q4(a) (ie. 2019-12-31) to remain the same during the year UNTILL the new accounting year starts. So when Q1(b)=2021-03-31, Q4(c)=2020-12-31 and Q4(a)=2020-12-31.
    In words, Q(b) and Q(c) change during the year where Q(a) remain the same with previous year's closing date, and it's only when the Q(b)/Q(c) year change as Q(a) changes closing date one year forward.
    I find the Q(a) value quite tricky to solve.

    Thank you and regards,
    Daniel

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 :)