Excel library

How to Use the IF Function with Dates in Excel (4 Methods)

Tracking overdue invoices, comparing delivery dates against deadlines, or checking whether a transaction falls inside a billing month gets slow when you scan dates by eye. Because Excel stores valid dates as sequential serial numbers, you can test them with standard comparison operators like <, >, and = to return clear labels such as Overdue or On Time. In this tutorial, I'll show you how to use the IF function with dates in Excel across four common scenarios.

Quick answer
  1. Compare a cell to a fixed date with DATE: =IF(B2<DATE(2026,12,10),"Before Cutoff","On or After")
  2. Compare two date cells directly: =IF(C2<=B2,"On Time","Late")
  3. Compare a date against today's date with TODAY: =IF(B2<TODAY(),"Overdue","Upcoming")
  4. Check if a date falls between two dates with AND: =IF(AND(B2>=$E$2,B2<=$F$2),"In December","Outside")

Always wrap hardcoded dates in the DATE function or store them in cells instead of typing date strings in quotes.

Method 1: Use the IF Function with a Specific Date (IF + DATE)

Use IF with the DATE function when you need to compare a column of dates against one fixed cutoff date inside the formula. This is the safest way to hardcode a date because DATE(year, month, day) works identically regardless of whether your system uses US (MM/DD/YYYY) or UK (DD/MM/YYYY) date settings.

Our sample data is in A1:B7, with invoice numbers in column A and valid Excel dates under Due Date in column B.

  1. Select cell C1 and type Cutoff Status as the column header.
  2. Select cell C2 and enter the IF and DATE formula below to test whether each invoice is due before December 10, 2026.
  3. Press Enter to return Before Cutoff for INV-201.
  4. Drag the fill handle at the bottom-right corner of C2 down to C7 to evaluate every row.
fxFormula
=IF(B2<DATE(2026,12,10),"Before Cutoff","On or After")
IF and DATE formula in cell C2 comparing due dates in B2:B7 against December 10, 2026 and returning Before Cutoff or On or After
The IF and DATE formula in C2:C7 flags every invoice due before December 10, 2026

How this works: DATE(2026,12,10) builds a true Excel date serial number for December 10, 2026. The IF function then checks whether the serial number in B2 (11/15/2026) is smaller than that cutoff date. Because 11/15/2026, 12/01/2026, and 12/05/2026 come earlier, C2:C4 return Before Cutoff, while C5:C7 return On or After.

Note: Do not type a date in quotes inside an IF comparison, such as =IF(B2<"12/10/2026",...). Excel treats quoted values as text strings, and in Excel comparisons any text string is evaluated as greater than any number, so B2<"12/10/2026" returns TRUE for every valid date regardless of the actual day.

Method 2: Compare Two Date Columns Using the IF Function

Use a direct cell-to-cell IF comparison when each row contains two dates, such as a Due Date and a Paid Date. Because both cells already hold Excel date serial numbers, you do not need the DATE function at all.

Our sample data is in A1:C7, with Due Date in column B and Paid Date in column C.

  1. Select cell D1 and type Payment Status as the column header.
  2. Select cell D2 and enter the IF formula below.
  3. Press Enter to return On Time for INV-201.
  4. Copy the formula from D2 down to D7 using the fill handle.
fxFormula
=IF(C2<=B2,"On Time","Late")
IF formula in cell D2 comparing Paid Date in column C against Due Date in column B to return On Time or Late in D2:D7
Comparing Paid Date in column C to Due Date in column B labels each invoice On Time or Late

How this works: The logical test C2<=B2 checks whether the Paid Date is earlier than or equal to the Due Date. For INV-201 (paid 11/12/2026, due 11/15/2026) and INV-203 (paid on the due date 12/05/2026), the test is TRUE and returns On Time. For INV-202, INV-204, and INV-206, the paid date is larger than the due date, so Excel returns Late.

Handling Blank Paid Dates

If some invoices have not been paid yet, their Paid Date cells will be blank. Excel treats a blank cell as 0 in a numeric comparison, which is smaller than any date and would falsely label an unpaid invoice as On Time. Wrap an outer IF check around the formula to catch blank cells first:

fxFormula
=IF(C2="","Unpaid",IF(C2<=B2,"On Time","Late"))

Note: If you also want to calculate how many days early or late each payment arrived, see our guide on the Excel formula for difference between two dates.

Method 3: Compare a Date to Today's Date Using IF and TODAY

Use IF with the TODAY function when you want a live tracker that updates automatically every time you open the workbook. Instead of editing a cutoff date manually, TODAY() pulls the current date from your computer's clock.

Our sample data is in A1:B7, and for this example assume today's date is 12/05/2026.

  1. Select cell C1 and type Status as the header.
  2. Select cell C2 and enter the IF and TODAY formula below.
  3. Press Enter to return Overdue for INV-201.
  4. Drag the fill handle down from C2 to C7 to check every due date against today.
fxFormula
=IF(B2<TODAY(),"Overdue","Upcoming")
IF and TODAY formula in cell C2 returning Overdue for dates before December 5, 2026 and Upcoming for December 5, 2026 or later
IF paired with TODAY automatically marks past due dates as Overdue in C2:C7

How this works: TODAY() takes no arguments and returns the current date's serial number (12/05/2026 here). The IF formula compares each due date in column B against that value. Because 11/15/2026 and 12/01/2026 are strictly earlier than 12/05/2026, C2 and C3 return Overdue, while 12/05/2026 and later dates return Upcoming. For more ways to use dynamic current dates, see our tutorial on the Excel formula for today's date.

Adding a Third "Due Today" Status

If you want items due today to stand out separately from future dates, nest a second IF inside the false branch:

fxFormula
=IF(B2<TODAY(),"Overdue",IF(B2=TODAY(),"Due Today","Upcoming"))

You can read more about chaining three or more outcomes in our guide to multiple IF statements in Excel.

Note: TODAY is a volatile function, meaning Excel recalculates it every time the workbook opens or any cell changes. If you need a static timestamp that never shifts tomorrow, type the cutoff date into a dedicated cell instead of calling TODAY().

Method 4: Check If a Date Falls Between Two Dates Using IF and AND

Use IF with the AND function when you need to test whether a date falls inside a start-and-end window, such as a specific month, quarter, or contract period. Putting the start and end dates in separate cells lets you change the reporting window without editing a single formula.

Our invoice table is in A1:B7, with Start Date (12/01/2026) in E2 and End Date (12/31/2026) in F2.

  1. Select cell C1 and type December? as the column header.
  2. Select cell C2 and enter the IF and AND formula below, using dollar signs to lock $E$2 and $F$2.
  3. Press Enter to return Outside for INV-201 (11/15/2026).
  4. Drag the fill handle down from C2 to C7 to test all six due dates against the December window.
fxFormula
=IF(AND(B2>=$E$2,B2<=$F$2),"In December","Outside")
IF and AND formula in cell C2 checking whether each due date in B2:B7 falls between Start Date in E2 and End Date in F2
IF with AND checks whether each due date in column B falls between the Start Date in E2 and End Date in F2

How this works: The AND function returns TRUE only when both conditions pass: the date in B2 must be greater than or equal to $E$2 (12/01/2026) and less than or equal to $F$2 (12/31/2026). The absolute references $E$2 and $F$2 stay fixed as you copy the formula down, so rows 3 through 6 return In December while 11/15/2026 and 01/08/2027 return Outside. For more multi-condition examples, check our walkthrough of the Excel formula for IF AND.

Hardcoding the Range with DATE

If you prefer not to keep helper cells on the sheet, replace $E$2 and $F$2 with two DATE functions directly inside AND:

fxFormula
=IF(AND(B2>=DATE(2026,12,1),B2<=DATE(2026,12,31)),"In December","Outside")

Note: If your IF formula returns a date instead of a text label (for example, =IF(B2<TODAY(),TODAY(),B2)) and Excel displays a five-digit number like 46361, select the formula column and change the number format on the Home tab to Short Date. See our guide on how to stop Excel from converting a date to a number in a formula for more fixes.

FAQs

Why doesn't =IF(B2<"12/10/2026","Yes","No") work in Excel?

Excel treats any value inside quotation marks as plain text rather than a date serial number. Because Excel always ranks text as greater than numbers in comparisons, a real date in B2 will always test as less than "12/10/2026". Use DATE(2026,12,10) or a cell reference instead.

Can I use DATEVALUE instead of DATE inside an IF formula?

Yes, DATEVALUE("12/10/2026") converts a date string into a real Excel serial number. However, DATE(2026,12,10) is more reliable because DATEVALUE depends on your computer's regional date format and can misread or return #VALUE! on another user's system.

How do I return a blank cell if the date cell is empty?

Wrap your date check inside an outer IF that tests for an empty cell first, such as =IF(B2="","",IF(B2<TODAY(),"Overdue","Upcoming")). Without that check, Excel treats the blank cell as 0 (January 0, 1900) and falsely flags it as Overdue.

Why does my IF formula show a 5-digit number instead of a date?

When an IF formula returns a date value, Excel outputs its underlying serial number if the result cell is formatted as General. Select the formula cells, open the Number Format dropdown on the Home tab, and choose Short Date or Long Date.

Why is my IF date formula giving the wrong result when the dates look valid?

One or more dates in your column may be stored as text rather than true Excel dates, which often happens after importing CSV files. Real dates align to the right by default in an unformatted cell; convert text dates using Data > Text to Columns or the DATEVALUE function before comparing them with IF.

Conclusion

Whenever you need to use the IF function with dates in Excel, the cleanest approach is to reference date cells directly (=IF(C2<=B2,"On Time","Late")) or pair IF with TODAY() for live deadline tracking. Use DATE(year, month, day) whenever you must hardcode a specific date so regional formats never break your sheet, and add AND when you need to check whether a date falls inside a start-and-end range.