How to Day Function in Excel

Learn multiple Excel methods to day function with step-by-step examples, real-world scenarios, and professional tips.

excelformuladate functionstutorial
10 min read • Last updated: 7/2/2025

How to Day Function in Excel

Why This Task Matters in Excel

Dates sit at the heart of almost every spreadsheet—project schedules, sales ledgers, invoice aging, stock control, payroll cut-offs, and countless other workflows all depend on accurate date handling. Often you need to look beyond the full date and isolate just the calendar “day” (1 through 31). Knowing the exact day component lets you:

  • Flag month-end transactions, for example highlighting anything entered on day 31
  • Trigger conditional formatting when a task is due on the 15th of each month
  • Calculate fiscal cut-off periods that always start on a specific day, such as day 26
  • Perform rolling analyses, like comparing sales on day 1 of every month across a whole year
  • Combine with other date parts (month and year) to rebuild custom period IDs, such as 2024-03-05

In finance, extracting the day helps create dynamic month-end accrual models and reconcile statements that post only on the last banking day. In logistics, dispatching systems frequently check whether an order was placed past the 20th so it can be consolidated into the next month’s shipping batch. HR teams schedule automated reminders for timesheets due on day 5. All of these rely on quickly and reliably isolating the day from a full date.

Excel excels (pun intended) at this task because its date serial number system stores every day as a whole number counting from 1 January 1900. That means the day, month, and year are already embedded; we simply need the right function to reveal the part we want. Failing to master this skill often leads to cumbersome text parsing, manual workarounds, or (worst-case) incorrect reports caused by hard-coding day values. Once you’re comfortable extracting the day, you’ll find it links naturally to adjacent skills—month and year extraction, dynamic date arithmetic, rolling period analysis, and time-intelligence functions in PivotTables and Power Query.

Best Excel Approach

The most direct and reliable way to extract the day number from a valid Excel date is the DAY function:

=DAY(serial_number)
  • serial_number – required. Any valid Excel date, a reference containing a date, or a formula that returns a date.

DAY is the preferred approach because:

  1. It is purpose-built for this task—clear, readable, and self-documenting.
  2. It works equally well with manually entered dates, results from other functions (e.g., TODAY(), EOMONTH()), or dates pulled from external data sources.
  3. It returns a value from 1 to 31 regardless of regional date formatting, which avoids confusion when workbooks circulate globally.

Use DAY whenever you need the pure day integer and you already have a proper Excel date. Alternatives such as TEXT or LEFT are appropriate only when the source is stored as text or a date requires a custom string output.

If you need to extract the day from a text-formatted date or assemble a custom label, the TEXT function is a powerful alternative:

=TEXT(serial_number,"d")

It still relies on a true Excel date in serial_number, but it lets you output “5” or “05” (using \"dd\") directly as text. We’ll compare this and other options later.

Parameters and Inputs

  • Serial number input must be a genuine Excel date—either typed, imported, or calculated. Internally, dates are numeric values (e.g., 45405 represents 15 Mar 2024 on the default 1900 date system).
  • Acceptable cell references: A1, [A2], ranges, or the output of formulas like TODAY(), DATE(), or EOMONTH().
  • Text dates: If your source is text (“03/15/2024”), wrap it in DATEVALUE or VALUE before applying DAY to avoid a #VALUE! error.
  • Error handling: Use IFERROR or LET to trap null or non-date inputs when working with external data feeds.
  • Time stamps: DAY ignores the time portion. A cell containing 15 Mar 2024 18:42 returns 15.
  • Leap years and varying month lengths are handled automatically; no extra logic required.

Edge cases: Blank cells return 0, not an error. Negative serial numbers (pre-1900 dates) work only in the 1904 system on Mac and specialized workbooks—test carefully if your organization maintains historical ledgers that old.

Step-by-Step Examples

Example 1: Basic Scenario – Extracting Day Numbers for Monthly Reporting

Imagine a simple expense list:

A (Date)B (Cost)
01-Jan-2024125
15-Jan-2024349
31-Jan-2024220
05-Feb-2024410
  1. Enter the data in [A2:B5].
  2. In C1, type “Day”.
  3. In C2, enter:
=DAY(A2)
  1. Auto-fill down to C5. The column now shows 1, 15, 31, 5.

Why it works: Column A holds true Excel date serials. DAY reads each serial and returns the day component. This allows quick pivoting—group spending by day, spot spikes on payroll day 31, or compare costs incurred on mid-month (day 15).

Troubleshooting: If any result shows ####, the column isn’t wide enough. If you see a date instead of a number, change the number format to General.

Variations:

  • Show a two-digit day by using `=TEXT(`A2,\"dd\").
  • Combine day with month in a helper column for a unique key: `=TEXT(`A2,\"mm-dd\").

Example 2: Real-World Application – Highlighting Invoices Raised After Cut-Off

Business scenario: Corporate policy states that invoices dated on or after day 26 fall into next month’s ledger. We want an automatic flag so Accounts Payable reclassifies them.

Dataset:

ABC
Invoice NoInvoice DateAmount
732122-Feb-20241,250
732226-Feb-20243,600
732328-Feb-20242,900
732405-Mar-20241,750

Steps:

  1. Select [A2:C5] and name the table InvoiceTable (Ctrl + T then rename).
  2. In D1, type “Post Next Month”.
  3. In D2, enter:
=IF(DAY([@Invoice Date])>=26,"Yes","No")
  1. Press Enter—structured references auto-fill the entire column.
  2. Apply a filter on column D to isolate “Yes” rows.

Logic: DAY pulls the day number. When the value is greater than or equal to 26, the IF statement marks it “Yes”. The team now instantly sees which invoices need ledger reclassification.

Integration:

  • Conditional formatting can shade “Yes” rows.
  • A PivotTable can summarize total amounts flagged.
  • For multiple currency ledgers, you can add exchange rate conversion next to the flag.

Performance: Even on tables with 50,000 rows, DAY and IF remain fast because they operate on simple numeric values.

Example 3: Advanced Technique – Dynamic List of Month-Ends Using Array Formulas

Goal: Generate a vertical list of the day number for the final business day of each month in a fiscal year. Useful for automated reconciliation templates.

Assumptions: Fiscal year starts July 2024. We want July 2024 through June 2025. In cell A1 type “Fiscal Month End”. In A2 enter the following dynamic array (Excel 365 or 2021):

=DAY(WORKDAY(EOMONTH(DATE(2024,7,1),SEQUENCE(12,1,0)),0))

Breakdown:

  1. DATE(2024,7,1) produces 01-Jul-2024.
  2. EOMONTH(..., SEQUENCE(12,1,0)) shifts from month 0 (July) to month 11 (June 2025), creating an array of month-end dates.
  3. WORKDAY(...,0) converts each month-end to the last business day (useful when month-end falls on a weekend or holiday).
  4. DAY extracts the day number from each adjusted date.
  5. The array spills from A2:A13 showing values like 31, 30, 29 (because Aug 31 2024 is a Saturday, etc.).

Edge handling: Add a holiday list in [E1:E20] and adjust WORKDAY to WORKDAY(EOMONTH(...),0,[E1:E20]) for full compliance. This advanced setup is invaluable in finance teams creating rolling month-end checklists.

Tips and Best Practices

  1. Always store dates as true dates, never as text. Use VALUE or DATEVALUE to convert imported strings before applying DAY.
  2. When building helper columns, give them descriptive headers like “Day of Month” so downstream users understand the purpose.
  3. Combine DAY with structured references in Excel Tables to make formulas self-extending and easy to audit.
  4. For dashboards, avoid extra columns by embedding DAY inside aggregations, e.g., `=SUMIFS(`Amount,DAY(DateColumn),\">=26\").
  5. Protect performance on huge data sets by turning off automatic calculation only while bulk-pasting dates, then re-enabling.
  6. Document any custom cut-off logic (e.g., “day greater than or equal to 26”) in worksheet comments or the formula bar to keep auditors happy.

Common Mistakes to Avoid

  1. Treating text dates as real dates. DAY returns #VALUE! if the cell is not a true serial number. Fix by wrapping the source in VALUE or re-formatting the column.
  2. Forgetting regional date settings when hard-coding. Typing 3/11/2024 on a UK machine stores 3 Nov, not 11 Mar, leading to wrong day numbers. Use DATE(y,m,d) for absolute clarity.
  3. Using DAY for weekday analysis. DAY gives the calendar day, not the day-of-week. For Monday-Sunday numbering, use WEEKDAY instead.
  4. Hard-coding cut-off day numbers. Embedding “26” directly in multiple formulas is brittle; centralize it in a named cell, then reference that cell.
  5. Ignoring empty cells in arrays. DAY of a blank cell becomes 0, which can corrupt totals when SUMming day numbers. Use IF to skip blanks.

Alternative Methods

Below is a quick comparison of methods you can use to pull or display day information:

MethodSyntaxReturnsProsCons
DAY`=DAY(`date)Integer 1-31Simple, reliable, numericRequires real date
TEXT (single “d”)`=TEXT(`date,\"d\")“1”-“31” textCustom formatting, pads freeText output may break math
TEXT (double “dd”)`=TEXT(`date,\"dd\")“01”-“31” textIdeal for codes needing two digitsText output, extra step for numbers
INT + MOD`=INT(`date)-INT(EOMONTH(date,-1))IntegerWorks even if date contains time stamp splitsLess readable, fragile
DAY via Power QueryDate.Day([Date])IntegerHandles very large datasets, integrates ETLRequires Power Query knowledge

When to choose:

  • Use DAY for 90 % of worksheet scenarios.
  • Use TEXT when you need padded strings like “05” for concatenated IDs.
  • Use Power Query if dates arrive in multi-million-row CSVs you transform before landing in Excel.

FAQ

When should I use this approach?

Use DAY any time you need the numeric day component of a valid date—month-end checks, recurring reminders, custom period keys, or conditional formatting based on the day.

Can this work across multiple sheets?

Yes. Reference the date cell with the sheet prefix, e.g., `=DAY(`Transactions!A2). Structured references in Tables also work seamlessly across sheets.

What are the limitations?

DAY cannot parse text dates or timestamps stored as text. It also cannot directly fetch weekday names—that requires WEEKDAY or TEXT(date,\"ddd\").

How do I handle errors?

Wrap formulas in IFERROR: `=IFERROR(`DAY(A2),\"Missing or invalid date\"). For large ranges, consider LET to calculate once and reuse.

Does this work in older Excel versions?

DAY has existed since Excel 2000, so any modern version supports it. Dynamic array examples (SEQUENCE) require Microsoft 365 or Excel 2021; older versions can generate the list with helper rows.

What about performance with large datasets?

DAY is extremely lightweight. Even on 100,000-row tables, recalculation completes almost instantly. For multi-million records, offload to Power Query or Power Pivot to keep workbook size manageable.

Conclusion

Mastering the extraction of the day component may feel like a small skill, yet it unlocks cleaner cut-off logic, sharper reporting, and fewer manual checks throughout your spreadsheets. Whether you’re reconciling month-end ledgers, flagging late invoices, or building advanced fiscal calendars, the DAY function (and its close relatives) give you an elegant, dependable tool. Keep practicing with your own data, explore combining DAY with other date functions, and soon you’ll weave dynamic date logic into every relevant Excel model. Happy spreadsheeting!

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.