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.
- Compare a cell to a fixed date with DATE:
=IF(B2<DATE(2026,12,10),"Before Cutoff","On or After") - Compare two date cells directly:
=IF(C2<=B2,"On Time","Late") - Compare a date against today's date with TODAY:
=IF(B2<TODAY(),"Overdue","Upcoming") - 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.
- Select cell C1 and type Cutoff Status as the column header.
- Select cell C2 and enter the IF and DATE formula below to test whether each invoice is due before December 10, 2026.
- Press Enter to return Before Cutoff for INV-201.
- Drag the fill handle at the bottom-right corner of C2 down to C7 to evaluate every row.
=IF(B2<DATE(2026,12,10),"Before Cutoff","On or After")
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.
- Select cell D1 and type Payment Status as the column header.
- Select cell D2 and enter the IF formula below.
- Press Enter to return On Time for INV-201.
- Copy the formula from D2 down to D7 using the fill handle.
=IF(C2<=B2,"On Time","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:
=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.
- Select cell C1 and type Status as the header.
- Select cell C2 and enter the IF and TODAY formula below.
- Press Enter to return Overdue for INV-201.
- Drag the fill handle down from C2 to C7 to check every due date against today.
=IF(B2<TODAY(),"Overdue","Upcoming")
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:
=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.
- Select cell C1 and type December? as the column header.
- Select cell C2 and enter the IF and AND formula below, using dollar signs to lock $E$2 and $F$2.
- Press Enter to return Outside for INV-201 (11/15/2026).
- Drag the fill handle down from C2 to C7 to test all six due dates against the December window.
=IF(AND(B2>=$E$2,B2<=$F$2),"In December","Outside")
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:
=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?
Can I use DATEVALUE instead of DATE inside an IF formula?
How do I return a blank cell if the date cell is empty?
Why does my IF formula show a 5-digit number instead of a date?
Why is my IF date formula giving the wrong result when the dates look valid?
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.