How to Convert Date to Number in Excel (4 Methods)

Get FREE Advanced Excel Exercises with Solutions!

In many situations, we need to convert a date to a number in Excel to accomplish a calculation. Working with date and time values is one of the trickiest parts of Excel. People store dates in different formats as the combination of day, month, and year. But what Excel does do to recognize a date? It stores dates as a number in the backend. In this article, we’ll get to know the methods that transform a date into a number.


1. Converting the Date to a Serial Number in Excel with the DATEVALUE Function 

We will convert a date to a number in Excel. Here is an overview of the final result.

NOTE: As we know Excel stores dates as serial numbers in its system. This serial number starts from 1 on the date 1/1/1900 and increases by 1 onwards.

Convert Date to Number in Excel

The DATEVALUE function in Excel converts a text-formatted date to a serial number that is recognizable as a date to Excel.

Syntax of the DATEVALUE function:

=DATEVALUE (date_text)
where date_text is the only argument.

Let’s follow the example:


#Example 1: DATEVALUE Function Argument in the Date Format

If the argument for the DATEVALUE function is in the date format, then we need to put the date inside double quotes to make the function work. See the screenshots below:

Screenshot 1: We can see that the selected column is in the date format.

Convert Date to Number in Excel

Screenshot 2: We put the date inside a double quote to make it text for the DATEVALUE function and then hit ENTER.

Convert Date to Number in Excel

The DATEVALUE function converted the date into a serial number.


#Example 2: DATEVALUE Function Argument in the Text Format

If the argument for the DATEVALUE function is in the Text format, then we just need to put the date inside the function to transform it into a serial number. Let’s follow the screenshots:

Screenshot 1: Here the selected cells contained a list of dates in Text format.

Convert Date to Number in Excel

Screenshot 2: Here in cell H6, we put F6 as the argument which contains the date 1/1/2022 (in Date format), and hit Enter to convert it to a serial number.


2. Converting Date to a Serial Number Changing the Formatting

In this method, we’ll use the Home tab of the Excel ribbon to transform a date into a 5-digit serial number.

  • This screenshot shows a list of dates in the Date format. From the Home tab, navigate to the Number section, there is a box that shows the format of the selected cells and options to change into another format.

Convert Date to Number in Excel

  • Now from the format options choose the General or the Number option.

Convert Date to Number in Excel

  • The above step will turn the date into a 5-digit serial number.

Similarly, we can have all other dates converted into a serial number.

 Convert Date to Number in Excel


3. Using Format Cells Dialog Box for Converting Date to Number

Open the Cell Formatting Option (3 ways):

  • The Context Menu in Excel provides the option of Cell Formatting named Format Cells. With the option of cell formatting, we can change the format for the selected cell. We can open the context menu by simply clicking the right button of our mouse on the selected cell.

 Convert Date to Number in Excel

  • We can also go to the Cells section from the Home tab.
  • From the Format tab, select the Format Cells option.

  • Press Alt + H + O + E on your keyboard to make the Format Cells window visible.

Now you have the Format Cells window opened. In the Number tab, select General from the Category list. This time we selected all the cells that contain dates, together. Finally, don’t forget to click the OK button.

Convert Date to Number in Excel


4. Using Custom Formatting to Transform the Date to an 8-digit Number (mmddyyyy or ddmmyyyy Format)

By following the ways (click here to see the ways) described in the previous method, we can open the cell formatting options easily. Then follow the steps below:

  • Go to the Number tab.
  • Select the Custom option from the Category.
  • Put mmddyyyy in the Type input box.
  • Finally, click the OK button.

Convert Date to Number in Excel

  • The above steps converted all the dates into 8-digit numbers in the mmddyyyy format. We can see the first 2 digits represent the month, the following 2 digits represent the day, and the last 4 digits are the year.

Convert Date to Number in Excel

Following the same procedure, we can have different formats like ddmmyyyy, yyyymmdd, etc.

Here is an overview:

Read More: How to Convert Date to Text YYYYMMDD 


Things to Remember

  • Sometimes it may happen while converting a date to a number, the result shows #### in the cell. It happens when the cell width is not enough to hold the serial numbers. Increasing the cell width will solve it immediately.
  • While using the default date system of Microsoft Excel for Windows the argument value must be in a range from January 1, 1900, to December 31, 9999. It fails to handle a date beyond this range.

Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Conclusion

Now, that we know the methods to convert a date to a number in Excel, it would encourage you to use this feature more confidently. Any questions or suggestions don’t forget to put them in the comment box below.


Related Articles


<< Go Back to Change Date Format | Date Format | Number Format | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Al Arafat Siddique
Al Arafat Siddique

Al Arafat Siddique, BSc, Naval Architecture and Marine Engineering, Bangladesh University of Engineering and Technology, has worked on the ExcelDemy project for two years. He has written over 85+ articles for ExcelDemy. Currently, he is working as a software developer. He is leading a team of six members to develop Microsoft Office Add-ins, extending Office applications to interact with office documents. Other assigned projects to his team include creating AI-based products and online conversion tools using the latest... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo