ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Logic
  3. IF Formulas With Dates in Excel: Before, After, Overdue

IF Formulas With Dates in Excel: Before, After, Overdue

By ExcelReady Team·Updated November 1, 2026·7 min read

The short answer

To use a date in an IF formula, compare the date cell with another date: =IF(B2<TODAY(),"Overdue","On time") flags anything due before today. For a fixed date, build it with DATE: =IF(B2>DATE(2026,12,31),"Next year","This year"). Don't type the date in quotes, because Excel then compares a number with text and gets it wrong.

Key takeaways

  • Dates are numbers in Excel, so < means before and > means after.
  • =IF(B2<TODAY(),"Overdue","") updates by itself every day.
  • Build fixed dates with DATE(year,month,day), never "31/12/2026" in quotes.
  • Subtract dates to get days: =IF(B2-TODAY()<=7,"Due soon","").
  • Check for blank dates first, because an empty cell counts as the earliest date.
On this page+
  1. How Excel compares dates
  2. How to compare two dates with IF
  3. How to flag overdue items with TODAY
  4. How to compare with a fixed date
  5. How to flag dates due soon
  6. How to handle blank dates
  7. How to check if a date is between two dates
  8. Why your IF date formula isn't working
  9. Practise it

An IF date formula in Excel compares a date with another date and returns a result, such as "Overdue" or "On time". It works because Excel stores every date as a number, so a later date is simply a bigger number. This guide shows the patterns you'll use most: overdue checks with TODAY, comparisons with a fixed DATE, due-soon warnings, late deliveries, and the traps that make date formulas silently fail.

How Excel compares dates#

Excel stores each date as a whole number: the count of days since 1 January 1900 (on Windows and current Mac versions). 1 November 2026 is stored as 46,327. What you see is just formatting.

That means the normal comparison operators work on dates:

TestMeaning
B2<C2B2 is before C2
B2>C2B2 is after C2
B2=C2Same day
C2-B2Number of days between them

The examples use this invoice list in A1:C5:

ABC
1InvoiceDue datePaid date
2INV-0115 Sep 202612 Sep 2026
3INV-0230 Sep 20264 Oct 2026
4INV-0310 Oct 202610 Oct 2026
5INV-0420 Oct 2026

How to compare two dates with IF#

Compare the two date cells directly. To check whether each invoice was paid late, type this in D2 and fill down (Windows: Ctrl+D; Mac: ⌘D):

Excel formula
=IF(C2>B2,"Late","On time")

INV-01 was paid early and INV-03 on the due date, so both show On time. INV-02 was paid four days late and shows Late. Paying on the due date counts as on time here because > doesn't include equal dates.

INV-04 has no paid date yet, and the formula shows On time, which is misleading. The blank-date section below fixes that.

How to flag overdue items with TODAY#

TODAY() returns the current date and updates every time the workbook recalculates. Compare a due date with it to flag anything overdue:

Excel formula
=IF(B2<TODAY(),"Overdue","Not due yet")

If today is 1 November 2026, every due date in the table is in the past, so all four rows show Overdue. That's only useful for unpaid invoices, so combine it with the paid date:

Excel formula
=IF(AND(C2="",B2<TODAY()),"Overdue","")

Now only INV-04 shows Overdue: it has no paid date and its due date has passed. The TODAY function guide explains how TODAY recalculates, and the guide to IF with AND covers combining tests.

How to compare with a fixed date#

Build the date with DATE(year, month, day) inside the formula:

Excel formula
=IF(B2<DATE(2026,10,1),"Q3","Q4")

INV-01 and INV-02 are due in Q3; INV-03 and INV-04 in Q4.

Don't write the date in quotes, like B2<"01/10/2026". Excel treats that as text, and when it compares a number with text, the text always counts as bigger. The test returns TRUE for every date, with no error to warn you. DATE also avoids confusion between day-month and month-day order, because the arguments are always year, month, day.

You can also test parts of a date. =IF(WEEKDAY(B2,2)>5,"Weekend","Weekday") checks whether a date falls on a Saturday or Sunday: with 2 as the second argument, WEEKDAY numbers Monday as 1 and Sunday as 7. Similarly, =IF(MONTH(B2)=12,"December","") picks out one month in any year.

How to flag dates due soon#

Subtract today's date from the due date to get the number of days left, then test that number.

Excel formula
=IF(AND(B2>=TODAY(),B2-TODAY()<=7),"Due soon","")

This shows Due soon for dates from today up to seven days ahead. The first test stops past dates from being flagged, because their days-left number is negative and would also be less than 7.

To show the number of days overdue instead of a label:

Excel formula
=IF(B2<TODAY(),TODAY()-B2,0)

If the result shows as a date, such as 12-Jan-1900, change the cell's format to Number. For a full tracker with colours and warnings, see building an expiry date tracker.

How to handle blank dates#

An empty cell counts as 0 in a comparison, and 0 is the earliest date Excel knows. So =IF(B2<TODAY(),"Overdue","") flags every empty row as overdue. Check for a blank first:

Excel formula
=IF(B2="","",IF(B2<TODAY(),"Overdue",""))

The same fix makes the late-payment formula honest about unpaid invoices:

Excel formula
=IF(C2="","Unpaid",IF(C2>B2,"Late","On time"))

INV-04 now shows Unpaid instead of On time. The guide to IF cell is blank covers other blank checks.

How to check if a date is between two dates#

Use AND with a lower and an upper limit, just like with numbers:

Excel formula
=IF(AND(B2>=DATE(2026,10,1),B2<=DATE(2026,10,31)),"October","")

INV-03 and INV-04 are due in October. The guide to IF between two numbers explains inclusive and exclusive limits. To total or count by date range instead of labelling each row, SUMIFS and COUNTIFS take date criteria, such as ">="&DATE(2026,10,1); the lesson on dates in criteria practises exactly that.

Why your IF date formula isn't working#

Check these when the results look wrong:

  1. Dates stored as text. Imported dates often sit on the left of the cell. Convert them with DATEVALUE or Data > Text to Columns.
  2. Dates typed in quotes in the formula. Use DATE(2026,10,1) instead.
  3. Times hidden in the dates. A value of 10 Oct 2026 3:00 PM is greater than DATE(2026,10,10). Compare with <DATE(2026,10,11) to include the whole day.
  4. Blank cells treated as old dates. Add a blank check first.
  5. Results shown as dates. Day differences sometimes inherit a date format. Switch the cell to Number.

For more IF basics, see the IF function explained simply or the IF function guide. If the cell holds words rather than dates, see IF with text.

Practise it#

Date logic shows up in operations, finance and admin tests: overdue invoices, expiring contracts, late deliveries. Practise dates in criteria in a live spreadsheet: you type the formula and it checks it instantly. Then practise the IF function, and try the operations case study to use date checks on a realistic task.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Was invoice INV-02 paid late? Click D3 and write an IF that shows Late if the paid date in C3 is after the due date in B3, otherwise On time.

fx
ABCDE
1
Invoice
Due date
Paid date
Status
2
INV-01
46280
46277
3
INV-02
46295
46299
4
INV-03
46305
46305
5
INV-04
46315
6
7
8

Tip: A later date is a bigger number, so the test is C3>B3.

Practise this in a lesson

LessonDates in criteria: totals by date range and monthCount and total rows between two dates with COUNTIFS and SUMIFS, build a monthly summary, and drive the date range from input cells.LessonThe IF functionMake a cell show one result or another depending on a condition, like Pass/Fail or Over/Under budget.Function guideIFLearn Excel's IF function with practical examples: flag budgets, label rows and return blanks. Avoid the classic mistakes and practice live.Function guideTODAYUse Excel's TODAY function for days until a deadline, overdue flags and ages that update by themselves. Examples, pitfalls and live practice.

Frequently asked questions

How do I write an IF formula with a date in Excel?

+

Compare the date cell with another date. For today's date use TODAY(): =IF(B2<TODAY(),"Overdue","OK"). For a fixed date use DATE: =IF(B2<DATE(2026,7,1),"Before July","July or later").

Why is my IF date formula not working?

+

Usually the date is typed as text, either in the formula ("1/7/2026" in quotes) or in the cells. Excel then compares text with numbers. Use DATE in formulas and make sure the cells hold real dates.

How do I check if a date is overdue in Excel?

+

Use =IF(B2<TODAY(),"Overdue",""). Add a blank check so empty rows aren't flagged: =IF(B2="","",IF(B2<TODAY(),"Overdue","")).

How do I flag dates due in the next 7 days?

+

Use AND with two tests: =IF(AND(B2>=TODAY(),B2-TODAY()<=7),"Due soon",""). It flags dates from today up to seven days ahead.

How do I compare two dates in Excel with IF?

+

Compare the cells directly: =IF(C2>B2,"Late","On time") shows Late when the date in C2 is after the date in B2.

Sources

  • IF function - Microsoft Support
  • TODAY function - Microsoft Support
  • DATE function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How Excel compares dates
  2. How to compare two dates with IF
  3. How to flag overdue items with TODAY
  4. How to compare with a fixed date
  5. How to flag dates due soon
  6. How to handle blank dates
  7. How to check if a date is between two dates
  8. Why your IF date formula isn't working
  9. Practise it

Keep reading

Dates· 6 min read

Expiry Dates in Excel: Days Left and Status Flags

An expiry date formula in Excel usually has three parts. Work out the expiry date with =EDATE(B2,12) for 12 months after the issue date. Count the days left with =C2-TODAY(). Then flag the status with =IF(C2<TODAY(),"Expired",IF(C2-TODAY()<=30,"Expiring soon","OK")). Because TODAY updates daily, the tracker stays current by itself.

Logic· 6 min read

The Excel IF Function Explained Simply

The Excel IF function checks a condition and returns one value when it's TRUE and another when it's FALSE. The syntax is =IF(logical_test, value_if_true, value_if_false). For example, =IF(B2>=70,"Pass","Fail") shows Pass for a score of 70 or more and Fail for anything lower. Text results go in double quotes.

Logic· 6 min read

IF With Text in Excel: Check Words and Partial Matches

To check if a cell equals a word, use =IF(A2="Paid","Done","Chase"). To check if a cell contains a word anywhere, use =IF(ISNUMBER(SEARCH("refund",B2)),"Refund","Other"). SEARCH finds the word's position or returns an error, and ISNUMBER turns that into TRUE or FALSE. Wildcards like * don't work with = inside IF.

More on logic

  • IF Greater Than in Excel (and Greater Than or Equal)
  • IF with OR in Excel: Pass When Any Condition Is Met
  • IF Then Formula in Excel: Simple Examples to Copy
  • Return Yes or No in Excel With IF
  • IFERROR in Excel: Hide Errors the Right Way
  • IFERROR With VLOOKUP: Replace #N/A With a Message
All logic articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free