To convert a date to a number in Excel, select the cell containing the date, go to the Home tab, click the Number Format dropdown menu (which usually says "Date"), and select General or Number. This works because Excel stores dates as sequential serial numbers, where January 1, 1900, is number 1 and every day thereafter increases the count by one.
Converting dates to numbers is an essential skill for advanced data analysis. While humans prefer to see "October 12, 2023," computers prefer integers. By stripping away the date formatting, you can perform complex mathematical calculations, calculate the exact number of days between two distant events, or prepare data for import into other software systems that do not recognize Excel's specific date formatting. Understanding this underlying numeric system allows you to manipulate time-based data with far more precision than simple visual date entries allow.
What You'll Need
- A computer with Microsoft Excel installed (Windows or macOS).
- A dataset containing cells formatted as dates.
- Basic familiarity with the Excel ribbon interface.
Step-by-Step
- Select Your Data: Click on the individual cell you wish to convert. To convert an entire column, click the letter at the top of the column (e.g., Column A) to highlight every cell in that vertical range.
- Locate the Home Tab: Ensure you are on the Home tab of the top ribbon. This is the default tab when you open a workbook.
- Open the Number Format Menu: In the middle of the Home ribbon, you will see a group labeled Number. There is a dropdown box that likely currently displays "Date" or "Short Date." Click the downward-facing arrow to open the formatting options.
- Change to General: From the list of options, select General. This removes all specific formatting and reveals the raw serial number Excel uses to track that date.
- Alternative: Change to Number: If you want more control over the appearance (such as removing decimal places), select Number instead of General. This will often add two decimal places (e.g., 45210.00).
- Adjust Decimals (Optional): If you chose the "Number" format, use the Decrease Decimal button (the icon with a blue arrow pointing right and zeros) located directly under the Number Format dropdown to remove the .00 and leave only the whole integer.
- Verify the Result: Check that your date (e.g., 01/01/2024) has changed to a five-digit number (e.g., 45292). This confirms the conversion was successful.
Common Mistakes
One of the most frequent errors is confusing a formatted date with a text-based date. If you change the format to "General" and the cell still looks like a date (e.g., it still says "12/05/2023"), it means the date was entered as text, not as a true Excel date value. Excel cannot convert text to a serial number using the formatting menu because it doesn't recognize the characters as a numeric value. You will need to use a function like =DATEVALUE() to fix this before the formatting steps will work.
Another common mistake is applying the change to the wrong range. Users often select a header row (which contains a word like "Date") and apply the General format. While this doesn't break the header, it can lead to confusion if you are trying to use a formula to convert a large batch of data and accidentally include non-date cells, leading to #VALUE! errors in your calculations.
Finally, some users attempt to manually type the serial number into a cell. While this works, it is highly inefficient and prone to error. Always use the formatting tools or formulas to ensure the integrity of the data remains intact across the entire spreadsheet.
Tips
Using the Keyboard Shortcut: If you prefer keyboard shortcuts over clicking through menus, select your date cells and press Ctrl + Shift + ~ (the tilde key). This is the shortcut for the "General" format and is the fastest way to toggle between a date view and a numeric view.
Handling Time Stamps: If your cell contains both a date and a time (e.g., 10/12/2023 14:30), converting it to a number will result in a decimal. The whole number represents the date, and the decimal represents the fraction of a 24-hour day. For example, .5 would represent 12:00 PM (noon). To get just the date number, you can use the =INT() function, which strips the decimal and leaves only the integer.
Creating a Dynamic Conversion: If you want to keep your original date column but have the number appear in a second column, do not use the formatting menu. Instead, use a simple formula: =A2*1 (assuming the date is in cell A2). Multiplying a date by one forces Excel to treat it as a number. You can then format that new column as "General." This allows you to maintain a human-readable record while performing numeric analysis side-by-side.
Calculating Days Between Dates: Once you have converted dates to numbers, subtraction becomes simple. If you have two dates converted to numbers (e.g., 45292 and 45200), subtracting the smaller from the larger will give you the exact number of days elapsed between those two dates without needing complex date-diff functions.
Troubleshooting
The date doesn't change to a number: As mentioned in common mistakes, this usually happens when the date is stored as text. To fix this, select the column, go to the Data tab, select Text to Columns, and immediately click Finish. This often "forces" Excel to re-evaluate the cells and recognize them as dates, after which the General format will work.
The number looks like 4.52E+04: This is Scientific Notation. It happens when the column is too narrow to display the full five-digit number. To fix this, hover your mouse over the boundary between the column letters at the top and double-click to auto-fit the column width, or drag the boundary to the right.
The result is a negative number or a strange date in the year 1900: This typically occurs if you are subtracting dates in the wrong order or if the date entered is before January 1, 1900. Excel's standard date system does not support dates prior to 1900 natively; these are treated as text and cannot be converted to serial numbers using these methods.
The cells show #VALUE!: This error appears if you tried to use a mathematical formula (like =A2*1) on a cell that contains a word or a date formatted as text. Check for leading spaces or hidden characters in your date cells. Using the =TRIM() function can help remove invisible spaces that prevent Excel from recognizing the date.
Frequently Asked Questions
Why does Excel use numbers for dates?
Excel uses serial numbers to make date calculations possible. It is much easier for a computer to subtract 45000 from 45100 to find a difference of 100 days than it is to calculate the difference between "February 14, 2023" and "May 25, 2023," which involves varying month lengths and leap years.
Can I convert the numbers back into dates?
Yes. Simply select the numeric cells, go to the Home tab, and change the Number Format dropdown from "General" or "Number" back to "Short Date" or "Long Date." The underlying value remains the same; only the visual representation changes.
What is the number 1 in Excel dates?
The number 1 represents January 1, 1900. Every whole number increase after that represents one full day. Therefore, the number 2 is January 2, 1900, and so on.
Does this work for dates in different regions?
Yes. Regardless of whether your region uses MM/DD/YYYY or DD/MM/YYYY, the underlying serial number is universal. A specific date will always result in the same serial number regardless of how it is displayed visually.
How do I convert only the month or year to a number?
Converting the whole date to a serial number won't give you just the month. To get the month as a number (1-12), use the formula =MONTH(A2). To get the year, use =YEAR(A2).
Will converting to numbers delete my original dates?
No. Changing the format does not delete the data; it only changes how the data is displayed. The actual value stored in the cell's memory remains identical whether it looks like a date or a number.