What is the DAY function?
=DAY(serial_number)DAY returns only the day of a date as a number: an integer from 1 to 31.
Inside Excel a date is a serial number (January 1, 1900 is 1), so it is hard to calculate with the year, month and day directly. Taking them apart with YEAR, MONTH and DAY lets you test conditions or build other dates.
DAY is common in billing and payroll: deciding which cycle a transaction falls in when the cutoff is the 20th, finding how many days a month has, or building the same day in other months. It returns only the day of the month, so the same day in different months gives the same number.
Arguments
- serial_number
- The date to take the day from: a cell with a date, the DATE function or the result of another date function.
DAY examples
Example 1. Take the day from a date
=DAY(A2)If A2 is 2026-05-04, the result is 4.
Example 2. With DATE
=DATE(YEAR(A2), MONTH(A2)+1, DAY(A2))Take the parts of A2 and add 1 to the month for the same day next month. If that day does not exist (as with January 31), it rolls into the following month; use EDATE for exactly one month later.
Example 3. Billing cutoff on the 20th
=IF(DAY(A2)<=20, "This cycle", "Next cycle")A transaction on or before the 20th goes into this month's cycle.
A2 =DAY(A2) Result 2026-05-04 4 This cycle 2026-05-20 20 This cycle 2026-05-21 21 Next cycle Example 4. Days in the month
=DAY(EOMONTH(A2, 0))The day number of the month end is the number of days. February 2026 gives 28.
Common mistakes
Typing a date as text
A date typed as text in quotes, such as "2026-5-4", may be read differently or fail depending on the computer's date settings. Microsoft recommends using the DATE function or a cell with a date.
Seeing the result as a date
The result of DAY is a plain number, not a date. If the result cell is formatted as a date, 4 shows up as an odd date; set the format to General or Number.
Using DAY on a difference
=DAY(B2-A2) is not the number of days between two dates; a 45-day gap returns 14. Use =B2-A2.
Text such as "5th"
Text from another system that is not a real date returns #VALUE!. Convert it to a date first.
FAQ
- Can DAY take a text date?
- Text Excel recognizes as a date, such as "2026-05-04", usually works, but it can depend on the computer's settings. A date cell or the DATE function is safer.
- How do I get the day of the week?
- Use WEEKDAY for a number, or TEXT(A2,"ddd") for the name.
- How do I get the first of the month?
- =DATE(YEAR(A2), MONTH(A2), 1), or =A2-DAY(A2)+1.
- How do I show the day with two digits?
- =TEXT(A2, "dd") returns text such as "04".