Excel Date to Serial Number: How to Convert
In this article
Excel stores dates as sequential serial numbers, where 1 equals January 1, 1900, and each day adds 1. This article explains how to convert a date to its serial number, how to go back, and how to avoid the common pitfalls that trip up most users.
in d | Date (as serial) | - | 45292 | 1 out serial | Serial number | - | d | 0 out weekday | Weekday (1=Sun) | - | mod(d-1,7)+1 | 0
Formula
The conversion is trivial: the serial number S is simply the date’s internal numeric value. In Excel, if cell A1 contains a date, then =A1 formatted as a number gives the serial. The underlying formula is:
S = date value
where S is an integer for dates after 1900. For example, January 1, 1900 = 1; January 2, 1900 = 2; and so on. For dates before 1900, Excel uses a different system (see below).
Worked Example
Using the default value of 45292 from the calculator block:
- Take the date serial: 45292.
- Because serial 1 = Jan 1, 1900, subtract 1 to get days since Dec 31, 1899: 45291 days.
- Divide by 365.25 (accounting for leap years) to get years: 45291 / 365.25 ≈ 124.0 years.
- Add 1900: 1900 + 124 = 2024. More precisely, 45292 corresponds to January 1, 2024.
So the serial number 45292 converts to January 1, 2024. The calculator’s first output shows the same serial number you input, confirming the direct relationship.
Why Excel Uses Serial Numbers
Excel stores dates as numbers so that arithmetic works naturally. You can subtract two dates to get the number of days between them, add 30 to a date to get 30 days later, and use dates in formulas like any other number. The serial number system was inherited from Lotus 1-2-3, which had a bug that made it treat 1900 as a leap year. Excel kept the bug for compatibility, so the serial numbers are off by one for dates after February 28, 1900.
How to Convert a Date to a Serial Number
There are several ways to see or convert the serial number:
- Change the number format: Select the cell with the date, press Ctrl+1 (or Cmd+1 on Mac), go to the Number tab, choose “General” or “Number”, and the cell will display the serial number.
- Use the VALUE function:
=VALUE(A1)returns the serial number of the date in A1. - Use the DATEVALUE function:
=DATEVALUE("1/1/2024")returns 45292, but only if the text is a valid date. - Use the DATE function in reverse: To get the serial from year, month, day, use
=DATE(2024,1,1)which returns 45292.
How to Convert a Serial Number to a Date
Going the other way is equally simple:
- Format as date: Select the cell with the serial number, press Ctrl+1, choose “Date” and pick a format.
- Use the TEXT function:
=TEXT(45292,"mm/dd/yyyy")returns “01/01/2024”. - Use the DATE function with YEAR, MONTH, DAY: If you want to break the serial into parts,
=YEAR(45292)returns 2024,=MONTH(45292)returns 1, and=DAY(45292)returns 1.
Common Mistakes and Pitfalls
Several issues trip up users when working with date serials:
- The 1900 leap year bug: Excel treats February 29, 1900 as a valid date (serial 60) even though 1900 was not a leap year. This means serial numbers for dates after February 28, 1900 are one higher than they should be. For example, March 1, 1900 is serial 61, but the correct serial would be 60.
- Dates before 1900: Excel does not support dates before January 1, 1900 in the serial system. If you try to enter a date like 12/31/1899, Excel treats it as text. For pre-1900 dates, you must use a different approach, such as storing the year separately or using a custom calendar.
- Time is a fraction: Times are stored as decimal fractions of a day. 12:00 PM is 0.5, 6:00 AM is 0.25, and so on. A full date and time is the integer part (date) plus the fraction (time). For example, January 1, 2024 at noon is 45292.5.
- Regional date formats: The DATEVALUE function depends on your system’s date settings. If you type
=DATEVALUE("1/1/2024")but your system expects day/month/year, it may return an error or the wrong date. Use the DATE function instead, which is unambiguous. - Copying and pasting: When you copy a date and paste it as text, you may get the serial number instead of the formatted date. Use “Paste Special” > “Values” and then format the cell as a date.
Alternatives to Serial Numbers
If you need to work with dates without dealing with serial numbers, consider:
- Text dates: Store dates as text in ISO format (YYYY-MM-DD) for sorting, but you lose the ability to do arithmetic.
- The DATE function: Always use
=DATE(year, month, day)instead of typing a date string. This avoids regional issues. - Power Query or Power Pivot: These tools handle dates natively and can convert serial numbers automatically when importing data.
- Google Sheets: Uses a similar system but with serial 1 = December 30, 1899, which avoids the leap year bug. Be aware when transferring data between Excel and Sheets.
When to Use Serial Numbers
Use serial numbers when you need to:
- Calculate the number of days between two dates (subtract the serials).
- Add or subtract days from a date (add to the serial).
- Compare dates in formulas (e.g.,
=IF(A1>B1,...)). - Use dates in functions like VLOOKUP or MATCH, which work better with numbers.
But avoid serial numbers when you need to display dates to users, or when you’re sharing files with people who might not understand the numeric format.
Frequently Asked Questions
What is the serial number for today’s date?
You can find it by entering =TODAY() in a cell and then formatting that cell as a number. The value will be the serial number for the current date. For example, if today is January 1, 2024, the serial is 45292.
Why does Excel show a date as a number like 45292?
That usually means the cell is formatted as “General” or “Number” instead of “Date”. Select the cell, press Ctrl+1, and choose a date format under the Number tab. The underlying value is still the serial number; only the display changes.
How do I convert a serial number to a date in Excel?
Select the cell with the serial number, go to the Home tab, and in the Number group, choose “Short Date” or “Long Date” from the dropdown. Alternatively, use the TEXT function: =TEXT(A1,"mm/dd/yyyy").
What is the serial number for January 1, 1900?
It is 1. That is the starting point of Excel’s date system. January 2, 1900 is 2, and so on. Note that due to the leap year bug, February 29, 1900 is serial 60, which should not exist.
Does Excel handle dates before 1900?
No, not as serial numbers. If you enter a date before January 1, 1900, Excel treats it as text. For such dates, you can store the year, month, and day in separate columns and do your own calculations, or use a custom add-in.
How do I convert a date to a serial number without changing the format?
Use the VALUE function: =VALUE(A1) returns the serial number of the date in A1, while leaving the original cell unchanged. You can also use =A1*1 or =A1+0 to force a numeric conversion.