Changing number to dates in excel

Format numbers as dates or times

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 More…Less

When you type a date or time in a cell, it appears in a default date and time format. This default format is based on the regional date and time settings that are specified in Control Panel, and changes when you adjust those settings in Control Panel. You can display numbers in several other date and time formats, most of which are not affected by Control Panel settings.

In this article

  • Display numbers as dates or times

  • Create a custom date or time format

  • Tips for displaying dates or times

Display numbers as dates or times

You can format dates and times as you type. For example, if you type 2/2 in a cell, Excel automatically interprets this as a date and displays 2-Feb in the cell. If this isn’t what you want—for example, if you would rather show February 2, 2009 or 2/2/09 in the cell—you can choose a different date format in the Format Cells dialog box, as explained in the following procedure. Similarly, if you type 9:30 a or 9:30 p in a cell, Excel will interpret this as a time and display 9:30 AM or 9:30 PM. Again, you can customize the way the time appears in the Format Cells dialog box.

  1. On the Home tab, in the Number group, click the Dialog Box Launcher next to Number.

    Dialog Box Launcher in Number group

    You can also press CTRL+1 to open the Format Cells dialog box.

  2. In the Category list, click Date or Time.

    Format Cells dialog box

  3. In the Type list, click the date or time format that you want to use.

    Note: Date and time formats that begin with an asterisk (*) respond to changes in regional date and time settings that are specified in Control Panel. Formats without an asterisk are not affected by Control Panel settings.

  4. To display dates and times in the format of other languages, click the language setting that you want in the Locale (location) box.

    Locale box selected in Format Cells dialog box

    The number in the active cell of the selection on the worksheet appears in the Sample box so that you can preview the number formatting options that you selected.

    Sample box selected in Format Cells dialog box

Top of Page

Create a custom date or time format

  1. On the Home tab, click the Dialog Box Launcher next to Number.

    Dialog Box Launcher in Number group

    You can also press CTRL+1 to open the Format Cells dialog box.

  2. In the Category box, click Date or Time, and then choose the number format that is closest in style to the one you want to create. (When creating custom number formats, it’s easier to start from an existing format than it is to start from scratch.)

  3. In the Category box, click Custom. In the Type box, you should see the format code matching the date or time format you selected in the step 3. The built-in date or time format can’t be changed or deleted, so don’t worry about overwriting it.

  4. In the Type box, make the necessary changes to the format. You can use any of the codes in the following tables:

    Days, months, and years    

To display

Use this code

Months as 1–12

m

Months as 01–12

mm

Months as Jan–Dec

mmm

Months as January–December

mmmm

Months as the first letter of the month

mmmmm

Days as 1–31

d

Days as 01–31

dd

Days as Sun–Sat

ddd

Days as Sunday–Saturday

dddd

Years as 00–99

yy

Years as 1900–9999

yyyy

If you use «m» immediately after the «h» or «hh» code or immediately before the «ss» code, Excel displays minutes instead of the month.

Hours, minutes, and seconds

To display

Use this code

Hours as 0–23

h

Hours as 00–23

hh

Minutes as 0–59

m

Minutes as 00–59

mm

Seconds as 0–59

s

Seconds as 00–59

ss

Hours as 4 AM

h AM/PM

Time as 4:36 PM

h:mm AM/PM

Time as 4:36:03 P

h:mm:ss A/P

Elapsed time in hours; for example, 25.02

[h]:mm

Elapsed time in minutes; for example, 63:46

[mm]:ss

Elapsed time in seconds

[ss]

Fractions of a second

h:mm:ss.00

AM and PM     If the format contains an AM or PM, the hour is based on the 12-hour clock, where «AM» or «A» indicates times from midnight until noon and «PM» or «P» indicates times from noon until midnight. Otherwise, the hour is based on the 24-hour clock. The «m» or «mm» code must appear immediately after the «h» or «hh» code or immediately before the «ss» code; otherwise, Excel displays the month instead of minutes.

Creating custom number formats can be tricky if you haven’t done it before. For more information about how to create custom number formats, see Create or delete a custom number format.

Top of Page

Tips for displaying dates or times

  • To quickly use the default date or time format, click the cell that contains the date or time, and then press CTRL+SHIFT+# or CTRL+SHIFT+@.

  • If a cell displays ##### after you apply date or time formatting to it, the cell probably isn’t wide enough to display the data. To expand the column width, double-click the right boundary of the column containing the cells. This automatically resizes the column to fit the number. You can also drag the right boundary until the columns are the size you want.

  • When you try to undo a date or time format by selecting General in the Category list, Excel displays a number code. When you enter a date or time again, Excel displays the default date or time format. To enter a specific date or time format, such as January 2010, you can format it as text by selecting Text in the Category list.

  • To quickly enter the current date in your worksheet, select any empty cell, and then press CTRL+; (semicolon), and then press ENTER, if necessary. To insert a date that will update to the current date each time you reopen a worksheet or recalculate a formula, type =TODAY() in an empty cell, and then press ENTER.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Sometimes importing data into spreadsheets can be a headache. While this issue is not directly related to Datawrapper, it’s a common problem with Excel that can be frustrating and time-consuming: Excel is trained to «detect» formats, and sometimes the software wrongly assumes that a certain number represents a date. If you enter 12/2, it will change to 2-Dec or 12. Feb. If you then ask Excel to change the format to «Text,» it shows you a weird high number like 44239. 

So, how can you show a column with values like 12/2 without having them converted into dates?

How to get around this in Excel

The trick is to choose the format of the column before you enter or paste the data:

  • Open Excel 
  • Select the columns or cells you want to paste into and choose «Text» in the format dropdown of the Home tab. You can also press Cmd+1 to select «Text» there and then click «Ok.» 
  • Now make sure that your data is pasted as text. To do so, go to the Home tab, then click on the little arrow next to «Paste» and select «Match Destination Formatting.» (To achieve the same result, you can also go to Edit > Paste Special…, and then select «Text» before clicking «Ok.»)
  • You’ll see little green triangles in the top left of your pasted cells. Select them, click on the warning sign ⚠️ and select «Ignore Error.»

Here’s a 30 second video showing the whole process: 

Please note that you can’t perform calculations such as SUM with the pasted text. 

Choosing the correct format in Datawrapper

Even if Excel now thinks that your numbers are text, our data visualization tool Datawrapper will be able to recognize them. As soon as you upload the numbers to Datawrapper, it guesses what data format your columns have. 

If that guess is wrong, you can easily change the format again. Click on the column, then choose the correct format in the drop-down menu that pops up on the left side:

Special formatting tricks to avoid having Excel change numbers into dates

Excel documentation has some additional tips on how to avoid that automatic change of numbers:

  • Manual inspection
    If your dataset has only a few lines, you can manually check whether datapoints where wrongly changed into dates. They are quite easy to spot in the columns.
  • To then change the format back: 
    • Add a space before the number. Press Enter to make sure that this space remains in the cell.
    • Or, add an apostrophe (‘) BEFORE you enter the number, e.g. ‘1/2. The apostrophe will not be displayed after pressing Enter.
    • Or, add a zero and space before number formats such as 1/2 to avoid the change to date format.
    • Or, change fractions into decimals, e.g. 1/2 to 0.5 (or 0,5, if that is your local decimal format).

Last updated on July 13, 2022

Let’s say you have an organization that makes hundreds of small transactions each day. You have several branches where the junior accountant punches in the numbers and dates into different software. It’s finally the end of the month, and you want to look at where you stand compared to the previous month.

This will require that you draw a gazillion charts, which is rather impossible to do unless you have a list of date-wise transactions. Since different branches may be using different programs, you will either need to import the data into an Excel file or type it in manually—you don’t have to be Einstein to make an instant choice here.

When you import data from databases, Excel may import those dates as text strings. The reason is, like Excel, not all programs store dates as serial numbers. When something is not a serial number, it’s not a date for Excel. This is why we are going to give you the rundown on some nifty formulas and methods that will help you create dates in your Excel worksheets.

Convert Text To Dates

How to Identify If Dates are Stored in Text?

When you try to use a certain list of dates with Excel tools like charts or PivotTables, they will fail to recognize data points as dates if they are stored as text. Although, there are several ways to just eyeball and determine if your list of dates are dates or text strings.

  •  Alignment

Excel right-aligns dates by default. If your list of dates is leaning on the left wall of the cell, it may make a light bulb go off. Those are not dates, they are text strings.

Dates-As-Text-VS-Dates-Alignment-001

  • Cell Format

The cell will be formatted as a “Date” in the Number Format box in Excel’s Home tab for data points that are recognized as dates by Excel.

Column-Formatted-As-Date-002

  • Check the Status Bar

If you select the list of dates, you should see Average, Count, and SUM computed in the status bar, while you will see only Count if your dates are text strings.

Status-Bar-In-Case-Of-Dates-And-Dates-As-Text-003

3 Ways to Convert Dates Stored as Text

Let’s see some of the ways to convert dates stored as text to a date value that Excel can recognize.

Method 1 – Using DATEVALUE and VALUE Functions

DATEVALUE function is a catalyst that changes a date in text format into a serial number that Excel will identify as a date.

The formula has a single argument where you will input the text string:

=DATEVALUE(A2)

Dates-As-Text-To-Dates-Using-DateValue-Function-004

Instead of adding a cell reference, you could also add a text string manually.

If you get a random five-digit number after using the formula, don’t panic. This is not a random number, this is the serial number that Excel recognizes as a date. To view it as a date, navigate to the Number group in Excel’s Home tab and change the cell’s format to Date — this should fix your output.

While DATEVALUE works perfectly well, the VALUE function goes a step further to include time in its return. Excel stores dates as a serial number, and time as a decimal value after that serial number. For example, if the serial number for December 25, 2001, is 37250, then 37250.5 will represent December 25, 2015, 12:00 PM, since 0.5 would mean half a day.

VALUE function’s syntax is similar to that of the DATEVALUE function:

=VALUE(A2)

Dates-As-Text-To-Dates-Using-Value-Function-005

Notice how the output for the first two rows returns 12:00 AM even though no time has been inserted for those dates under the DATES column. This is because Excel reads this as an integer (naturally, since there is no decimal value), and therefore assumes the time as 12:00 AM, i.e. 0 hours into the returned date.

In the last row, we have entered 15:00 (i.e. 3 PM) as time. Notice how the VALUE function returns a serial number with a decimal value. If you want to manually compute time using this decimal value, just multiply it with 24 (0.625 * 24 = 15).

Method 2 – Using SUBSTITUTE + VALUE/DATEVALUE Function

VALUE function is a catalyst that changes a date in text format into a serial number that Excel will identify as a date.

In our example, we will use the VALUE function, but the formula will work the same way even if you choose to use the DATEVALUE function. The only difference being that the DATEVALUE function will not return the time component if any is present in your cells.

Let’s set up an example: we have a list of dates with a delimiter other than a forward slash (/) or a dash (-). Excel is currently reading the elements of this list as a text string. There are two ways to convert these text strings into a date. We have the following list of dates:

Dates-With-Dot-As-Sperator-006

  • First, we could use the Replace tool in Excel to replace the delimiter.

Find-And-Replace-Option-Excel-007

  • Go to Home > Find & Select > Replace (Shortcut: Ctrl+H).

Replace-Dot-With-Forward-slash-008

  • In the Find and Replace dialog box, enter a full stop (.) in the Find what text box, and a forward slash (/) in the Replace with text box. Down below, hit the Replace All (i.e. leftmost) button.

Final_Result_Replcaced-Dot-With-Slash

However, there is an easier way if you regularly populate your spreadsheet with new data — use a formula.

We know from our previous examples that the VALUE function is capable of converting text strings into a date. There is one caveat, though. Our text strings have a delimiter that keeps Excel from reading them as a date. So, we will need to supply a text string that has delimiters that Excel associates with a valid date.

Here’s the formula we will use:

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

Replacing-Dot-In-Date-Format-With-Value-Substitute-formula-010

VALUE function does the same job here. It converts a text string into a date. We have nested a SUBSTITUTE function to deal with the delimiter issue. Had we directly referenced cell A2 inside the VALUE function, it would have returned a #VALUE! error since this text string cannot be recognized as a valid date in Excel.

All we need to do, then, is change the delimiter using the SUBSTITUTE function. Think of the SUBSTITUTE function as a formula for the Find & Replace tool we used in our previous example. It has 3 arguments: the first argument is a cell reference, the second argument is the character we want to replace, and the third argument is the character we want to replace with.

After executing the SUBSTITUTE function, our formula will look like this:

=VALUE("12/25/2001")

This should give us our final output, an Excel-recognizable date — 12/25/2001.

Method 3 – Using Text to Columns tool for Complex Text Strings

Last year, you made a terrible decision of hiring a sloppy manager who didn’t bother to create separate columns for the weekday and date. This has led you to pull your hair while trying to analyze your sales data.

Fret not, we will work together and see this problem through.

The sloppy employee has made entries like so:

Tuesday, December 25, 2001.

To convert these strings to dates, we will use a two-step process. Step 1 involves using an Excel tool called “Text to Columns,” and Step 2 involves using the DATE and MONTH function.

Step 1:

  • Select the list of text strings you wish to convert to dates.

Date-Text-To-Columns-Excel-011

  • Navigate to the Data Tools group under the Data tab and click on Text to Columns.

Step-2-Date-Text-To-Columns-Excel-012

  • Choose Delimited in the dialog box that opens, and click Next.

Step-3-Date-Text-To-Columns-Excel-013

  • On the next screen, you will choose the delimiters used in your text strings from the list. It is important to note that even space is considered a delimiter. Since our text strings have a space following the commas, we will check both delimiters on the list.
  • At the bottom of the dialog box, you will see a preview of how the text strings will be split after you click Next.

Step-4-Date-Text-To-Columns-Excel-014

You have split the data, but there are still some miscellaneous things you need to run through. On the next screen, you will have the option to exclude any particular column from your output. For example, if the weekdays are irrelevant for you, exclude them by selecting the column (the column will turn black when selected), and choosing Do not import column (skip).

You may feel it is logical to choose Date under the Column data format list for the rest of the columns. However, remember that your text strings have been split into 3 components, and they cannot be recognized by Excel as a date. So, let them be formatted as General for now.

Finally, choose a destination where you want the return to be inserted, and click Finish.

Step 2:

We have our date split into three columns, and all we need to do now is bring them together and hand them over to Excel as a date. Although, there is still one loose end. Our month is a text string, while the DATE function needs a number.

To convert a month’s name to a number, we will nest the MONTH function inside the DATE function’s month argument. However, the MONTH function cannot work with just a text string, it needs a date so it can validly return the month number. We will circle back to this in a moment.

We will use this DATE formula:

=DATE(D2, MONTH(1&B2), C2)

Step-5-Date-Text-To-Columns-Excel-015

If you are unfamiliar with the DATE function, take a quick tour of our DATE function tutorial.

The first and last arguments are just cell references to numbers that correspond to the year and date, respectively. So, what’s happening with the MONTH function?

Well, here’s what we are instructing the month function: Look at the value in D2 and give me the number from 1 to 12 for that month.

Had we only referenced the cell, the MONTH function could not have recognized the month. To remedy this, we concatenate a 1, which means it is now a date that the MONTH function can work with. 1 is just an arbitrary date, of course. You could have entered any number from 1 to 30/31 and it would still work.

So, we have now supplied the DATE function with all of its 3 arguments. This should give you a list of just the dates without the weekdays, and you can manipulate these dates in your worksheet as you see fit.

How and Why are Dates Stored as Numbers?

We know that Excel stores dates as serial numbers. Naturally, Excel does not just assign any random number to the dates; it follows a pattern. We will talk about this pattern in just a moment, but let’s first look at why Excel does this.

Why

There are several functions in Excel that manipulate the dates in the worksheet, including the DAYS, DATE, WORKDAY, DATEVALUE functions, among many others. These formulas need a standardized format that they can recognize as a date.

Consider that you are using the DAYS function, and have supplied two dates. You enter the end_date and the start_date and Excel computes the number of days to give you the output, i.e. the number of days between these dates.

In absence of serial numbers, Excel would have to use some alternate method to perform this computation. However, since Excel assigns a serial number, all it needs to do is subtract the two serial numbers and the resultant number will the number of days between these dates.

How

It is quite straightforward. Excel assigns ‘1’ to January 1, 1900. It adds 1 for each day from thereon. For example, January 2, 1900, will be assigned ‘2’.

January 1, 2021, is assigned 44197, which means 01/01/2021 occurs 44196 days after January 1, 1900.

This simplifies the computation and manipulation of dates to a great degree.

2 Ways to Convert Dates Stored as Numbers

We have some dates stored in our worksheet, but instead of being stored as dates, those cells have been formatted as General/Text/etc.

There are two ways we can convert these numbers to dates. Both instruct Excel to do the same thing, but in different ways.

Method 1: Format Cells Dialog Box

To convert the list of serial numbers to dates using this method:

  1. Select the cells containing the values.
  2. Navigate to the Number group under the Home tab in Excel.
  3. Select Short Date or Long Date from the dropdown menu. This should convert the numbers to dates. However, if you want a custom format for your dates, continue to the next step.
  4. Instead of opening the drop-down menu, click on the little arrow at the bottom-right of the Number group section. This should open up the Format Cells dialog box.
  5. Select Date on the list that appears at the left of the dialog box.
  6. You will see several date display formats listed in a box titled Type.

This will allow you to use a format of your choosing. However, if your desired format is not listed in the box, follow these steps:

  1. Instead of selecting Date from the list, select Custom. You will see several Custom formats listed in the box titled Type.
  2. If you want to create a format on your own, use the following codes:
Code Output
yyyy Displays a 4-digit year: 1900-9999
yy Displays a 2-digit year: 00-99
dddd Displays weekdays: Sunday-Saturday
ddd Displays 3-letter weekdays: Sun-Sat
dd Displays the day component of the date, including 0: 01-31
d Displays the day component of the date, excluding 0: 1-31
mmmmm Displays the first letter of a month: J-D
mmmm Displays the full month name: January-December
mmm Displays the first three letters of a month: Jan-Dec
mm Displays a number representing the month, including 0: 01-12
m Displays a number representing the month, excluding 0: 1-12

These codes will also come in handy while applying Method 2. Speaking of which…

Method 2: Using the TEXT Function

This time around, we will use the TEXT function instead of manually formatting the cells.

The formula we will use is:

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

Serial-Numbers-To-Date-Excel-016

The formula does a very simple thing. It looks at cell A2 and applies the format “mm/dd/yyyy” to the text string in that cell.

It is essentially the same as what we did with the Format Cells dialog box, but with a formula. If you want a different format, refer to the table of codes above and adjust your formula accordingly.

How to Convert an 8-digit Date to an Excel-Recognizable Date

This is not a valid 5-digit serial number that Excel can recognize as a date. Therefore, we cannot directly change the cell’s format to convert it into a date. We will need an alternative method that involves parsing the text string and pulling its various components together using several functions to get our final output.

Here is the formula we will use:

=DATE(LEFT(A2, 4), MID(A2, 5, 2), RIGHT(A2, 2))

Eigth-Digit-Date-Format-To-Date-In-Excel-017

The DATE function will help us assemble the different components of a date via its year, month, and day arguments. These arguments all have different functions that will relay the information to them.

The LEFT, MID, and RIGHT function pick out the relevant component from the text string and relay that number to the DATE function. In our example, the LEFT function looks inside cell A2 and relays the first 4 characters of the text string contained in cell A2 as a year argument in the DATE function.

You can also use this formula if you have different delimiters in the text string separating the year, month, and day components of the date. All you need to do is adjust the character count in the LEFT, MID, and RIGHT functions.

Fixing Text Dates with Two-Digit Years

Unless you have entered a Custom format for any cell, a date that has a two-digit year will not sit well with Excel. Excel will add a green arrow at the top-left corner of each cell that has a date with a two-digit year.

To tackle this, hover your cursor over the cell. Doing this will bring up a drop-down button at the right of the cell with a yellow sign containing an exclamation mark. This sign tells you that there is an error, and you will see fixes (and other options) for the error in the dropdown menu.

The fixes will include two options, asking your preference regarding turning your dates into one that has a four-digit year. The first option will convert the year component into 19XX, the second will convert it to 20XX.

Two-Digit-Format-Error-Excel-018

How to Enable/Disable Two-Digit Error Checking

If you do not see the error warning, you may have disabled error checking. You can enable/disable error checking by navigating to File > Options > Formulas and checking/unchecking the box besides the option that reads Enable background error checking.

You will also see specific Error checking rules down below. To get a warning for two-digit years, make sure you have checked the box besides the option that reads Cells containing years represented as 2 digits.

Two-Digit-Format-Error-Excel-Option-Off-019

This takes care of almost all methods of converting text or numbers to date in Excel. Several other formulas could be used as alternative methods since Excel has a giant pool of powerful formulas, but the ones we discussed should help you sail through almost any date-conversion-related issues.

Drill these techniques by practicing them. By the time they become second nature to you, we will have some more formulas for you to explore.

Excel stores date and time values as serial numbers in the back end.

This means that while you may see a date such as “10 January 2020” or “01/10/2020” in a cell, in the back-end, Excel is storing that as a number. This is useful as it also allows users to easily add/subtract date and time in Excel.

In Microsoft Excel for Windows, “01 Jan 1900” is stored as 1, “02 Jan 1900” is stored as 2, and so on.

Below, both columns have the same numbers, but Column A shows numbers and Column B shows the date that’s represented by that number.

Same numeric value as number and as date

This is also the reason that sometimes you may expect a date in a cell but end up seeing a number. I see this happening all the time when I download data from databases or web-based tools.

It happens when the cell format is set to show a number as a number instead of a date.

So how can we convert these serial numbers into dates?

That’s what this tutorial is all about.

In this tutorial, I would show you two really easy ways to convert serial numbers into dates in Excel

Note: Excel for Windows uses the 1900 date system (which means that 1 would represent 01 Jan 1900, while Excel for Mac uses the 1904 date system (which men’s that 1 would represent 01 Jan 1904 in Excel in Mac)

So let’s get started!

Convert Serial Numbers to Dates Using Number Formatting

The easiest way to convert a date serial number into a date is by changing the formatting of the cells that have these numbers.

You can find some of the commonly used date formats in the Home tab in the ribbon

Let me show you how to do this.

Using the In-Built Date Format Options in the Ribbon

Suppose you have a data set as shown below, and you want to convert all these numbers in column A into the corresponding date that it represents.

Dataset that has the numbers

Below are the steps to do this:

  1. Select the cells that have the number that you want to convert into a dateSelect the cells that have the numbers
  2. Click the ‘Home’ tabClick the home tab
  3. In the ‘Number’ group, click on the Number Formatting drop-downClick on the number formatting drop down
  4. In the drop-down, select ‘Long Date’ or Short Date’ option (based on what format would you want these numbers to be in)Select the long date format

That’s it!

The above steps would convert the numbers into the selected date format.

Serial numbers converted to dates

The above steps have not changed the value in the cell, only the way it’s being displayed.

Note that Excel picks up the short date formatting based on your system’s regional setting. For example, if you’re in the US, then the date format would be MM/DD/YYYY, and if you are in the UK, then the date format would be DD/MM/YYYY.

While this is a quick method to convert serial numbers into dates, it has a couple of limitations:

  • There are only two date formats – short date and long date (and that too in a specific format). So, if you want to only get the month and the year and not the day, you won’t be able to do that using these options.
  • You cannot show date as well as time using the formatting options in the drop-down. You can either choose to display the date or the time but not both.

So, if you need more flexibility in the way you want to show dates in Excel, you need to use the Custom Number Formatting option (covered next in this tutorial).

Sometimes when you convert a number into a date in Excel, instead of the date you may see some hash signs (something like #####). this happens when the column width is not enough to accommodate the entire date. In such a case, just increase the width of the column.

Creating a Custom Date Format Using Number Formatting Dialog Box

Suppose you have a data set as shown below and you want to convert the serial numbers in column A into dates in the following format – 01.01.2020

Dataset that has the numbers

Note that this option is not available by default in the ribbon method that we covered earlier.

Below are the steps to do this:

  1. Select the cells that have the number that you want to convert into a date
  2. Click the ‘Home’ tab
  3. In the Numbers group, click on the dialog box launcher icon (it’s a small tilted arrow at the bottom right of the group)Click on the dialog box launcher
  4. In the ‘Format Cells’ dialog box that opens up, make sure the ‘Number’ tab selectedMake sure numnber tab is selected
  5. In the ‘Category’ options on the left, select ‘Date’Select date from the category list
  6. Select the desired formatting from the ‘Type’ box.Select the format in which you want the dates
  7. Click OK

The above steps would convert the numbers into the selected date format.

Final result with the desired date format

As you can see, there are more date formatting options in this case (as compared with the short and long date we got with the ribbon).

And in case you do not find the format you are looking for, you can also create your own date format.

For example, let’s say that I want to show the date in the following format – 01/01/2020 (which is not already an option in the format cells dialog box).

Here is how I can do this:

  1. Select the cells that have the numbers that you want to convert into a date
  2. Click the Home tab
  3. In the Numbers group, click on the dialog box launcher icon (it’s a small tilt arrow at the bottom right of the group)
  4. In the ‘Format Cells’ dialog box that opens up, make sure the ‘Number’ tab selected
  5. In the ‘Category’ options on the left, select ‘Custom’Select custom in the format cells dialog box
  6. In the field on the right, enter
    mm/dd/yyyy

    Enter mmddyyyy format in the type field

  7. Click OK

The above steps would change all the numbers into the specified number format.

Result in the specified date format

With custom format, you get full control and it allows you to show the date in whatever format you want. You can also create a format where it shows the date as well time in the same cell.

For example, in the same example, if you want to show date as well as time, you can use the below format:

mm/dd/yyyy hh:mm AM/PM

Below is the table that shows the date format codes you can use:

Date Formatting Code How it Formats the Date
m Shows the Month as a number from 1–12
mm Show the months as two-digit numbers from 01–12
mmm Shows the Month as three-letter as in Jan–Dec
mmmm Shows the Months full name as in January–December
mmmmm Shows the Month name first alphabet as in J-D
d Shows Days as 1–31
dd Shows Days as 01–31
ddd Shows Days as Sun–Sat
dddd Shows Days as Sunday–Saturday
yy Shows Years as 00–99
yyyy Shows Years as 1900–9999
Also read: How to Convert Text to Date in Excel (Easy Formulas)

Convert Serial Numbers to Dates Using TEXT Formula

The methods covered above work by changing the formatting of the cells that have the numbers.

But in some cases, you may not be able to use these methods.

For example, below I have a data set where the numbers have a leading apostrophe – which converts these numbers into text.

Numbers with apostrophe

If you try and using the inbuilt options to change the formatting of the cells with this data set, it would not do anything. This is because Excel does not consider these as numbers, and since dates for numbers, Excel refuses your wish to format these.

In such a case, you can either convert these text to numbers and then use the above-covered formatting methods, or use another technique to convert serial numbers into dates – using the TEXT function.

The TEXT function takes two arguments – the number that needs to be formatted, and the format code.

Suppose you have a data set as shown below, and you want to convert all the numbers and column A into dates.

Dataset to convert numbers to dates using the TEXT formula

Below the formula that could do that:

=TEXT(A2,"MM/DD/YYYY")

TEXT formula result

Note that in the formula I have specified the date formatting to be in the MM/DD/YYYY format. If you need to use any other formatting, you can specify the code for it as the second argument of the TEXT formula.

You can also use this formula to show the date as well as the time.

For example, if you want the final result to be in the format – 01/01/2020 12:00 AM, use the below formula:

=TEXT(A2,"mm/dd/yyyy hh:mm AM/PM")

In the above formula, I have added the time format as well so if there are decimal parts in the numbers, it would be shown as the time in hours and minutes.

If you only want the date (and not the underlying formula), convert the formulas into static values by using paste special.

One big advantage of using the TEXT function to convert serial numbers into dates is that you can combine the TEXT formula result with other formulas. For example, you can combine the resulting date with the text and show something such as – The Due Date is 01-Jan-2020 or The Deadline is 01-Jan-2020

Note: Remember dates and time are stored as numbers, where every integer number would represent one full day and the decimal part would represent that much part of the day. So 1 would mean 1 full day and  0.5 would mean half-a-day or 12 hours.

So these are two simple ways you can use to convert serial numbers to dates in Microsoft Excel.

I hope you found this tutorial useful!

Other Excel tutorials you may like:

  • How to SUM values between two dates (using SUMIFS formula)
  • How to Stop Excel from Changing Numbers to Dates Automatically
  • How to Remove Time from Date/Timestamp in Excel
  • Calculate the Number of Months Between Two Dates in Excel
  • Excel DATEVALUE Function – Convert Date in Text into Serial Date Formats
  • How to Convert Numbers to Text in Excel
  • How to Compare Dates in Excel (Greater/Less Than, Mismatches)
  • Convert Scientific Notation to Number or Text in Excel
  • How To Convert Date To Serial Number In Excel?

How to Change 5 Digit General Numbers to Date Format in Excel

It sometimes happens that we type or copy/paste date formats from sheets in Excel, but it displays as number. Let’s convert those 5-digits general numbers to date format with 2 easy steps using default date formatting function.

For example, we copied date from external source or wrote date in the cell but it displays in 5 digit number format as shown in the below screenshot:

convert-date-5

Follow 2 easy steps to change 5 digit number format to date format.

Select the 5 digits numbers and click Number format box in Home Tab. Now select Short Date as shown below:

convert-date-2

All selected 5 digits numbers converted to dates with default date formatting as shown below:

convert-date-3

If you have any queries or suggestions, feel free to comment below. I will be happy to reply you.

I have worked in Excel and like to share functional excel templates at ExcelDataPro.

Понравилась статья? Поделить с друзьями:
  • Changing lives one word at a time
  • Changing languages in excel
  • Changing format of cells in excel
  • Changing comments in word
  • Changing commas to dots in excel