Whether you’re managing schedules, tracking deadlines, or analyzing time-based data, comparing dates in Excel is a critical skill. This guide walks you through how to use the powerful IF
function to compare dates—such as determining if one date is before, after, or equal to another. Learn essential Excel formulas that simplify date logic and help you make smarter, faster decisions in your spreadsheets.
At first glance, IF formulas for dates may appear like those for numeric and text values. However, that is not the case. Unlike many other functions, IF does not inherently recognize dates in logical tests and instead treats them as plain text strings. This means you cannot directly use dates like “1/1/2025″ or conditions such as >”1/1/2024.”
To ensure the IF function correctly interprets a date, you must enclose it within the DATEVALUE function or use some other function to make an Excel-compatible date (e.g. Today())
Why? Understand how Excel saves date/time Dates, time and duration, the truth in Excel
Five ways to turn text into Excel dates
For example, you can check if a given date is greater than a specific date using the following formula:
=IF(B2>=DATEVALUE ("12 April 2024"), "Future", "Completed")
This formula evaluates the dates in column B. If the date is 12 April 2024, or later, it returns “Future”; otherwise, it returns “Completed” for earlier dates.
Of course, you can also enter the target date in a predefined cell (e.g., D1) and reference it in the formula. Just be sure to lock the cell address using the $ sign to make it an absolute reference. For example:
=IF(B2>$D$1, "Coming soon", "Completed")
This ensures that the reference to D1 remains fixed when copying the formula to other cells.
To compare a date with the current date, use the TODAY() function. For example:
=IF(B2>TODAY (), "Coming soon", "Completed")
This formula determines whether the date in B2 is later than today. If it is, it returns “Coming soon”; otherwise, it returns “Completed” for past or current dates.
Dates, time and duration, the truth in Excel
Excel Users: Are Your Date Calculations Accurate?
Simple text with day, month and year to Excel date conversion
Six ways to put the date and time into Excel