Formula Errors

Excel Formula to Return Valid or Expired Based on Two Dates

Huma Ashraf ChHuma Ashraf Ch Oct 10, 2026 872 views

Question details

The user wants an Excel formula that checks two date cells against the current date, returning "Valid" if both dates are in the future, and "Expired" if at least one date has passed.

How to Use an Excel Formula to Return Valid or Expired by Date
Product
Excel
Device & OS
not provided
Scenario
Tracking expiration dates, memberships, or certifications where two distinct date criteria must remain valid simultaneously.
Observed behavior
The goal is to automate the status categorization of items as "Valid" or "Expired" dynamically based on today's system date.
Before you start

Ensure that the date values in your reference cells are formatted as real Excel dates and not stored as text, as text dates will cause formula calculation errors.

Solution 1Recommended

Use IF, AND, and TODAY Functions

This method combines logical conditions to dynamically compare two reference dates against the current system date, returning a specific text output.

The IF function allows you to return one value if a condition is true and another if it's false. By nesting the AND function, you can evaluate multiple date cells at once. The TODAY function automatically retrieves the current date, ensuring your sheet is always up to date.

1
Select the result cell

Click on the cell (for example, C2) where you want the "Valid" or "Expired" status to be displayed.

2
Enter the formula

Type the formula: =IF(AND(A2>TODAY(), B2>TODAY()), "Valid", "Expired") into the formula bar. This assumes your two reference dates are located in cells A2 and B2.

3
Apply the logic

Press the Enter key to calculate the result for the first row.

4
Copy the formula down

Click and drag the fill handle (the small square at the bottom-right corner of the cell) down the column to apply the formula to the rest of your data.

Use IF, AND, and TODAY Functions
Date Formatting Check: If the formula incorrectly returns "Expired" for future dates, your cells may be stored as text. Select your date cells, right-click, choose 'Format Cells', and ensure the 'Date' format is applied.

Seamlessly Calculate Expiration Dates in WPS Spreadsheet

WPS Spreadsheet provides full support for complex logical and date formulas, allowing you to track valid and expired entries accurately and efficiently.

  1. 1. Open your file in WPS: Launch WPS Spreadsheet and open your existing workbook containing the date records.
  2. 2. Verify data format: Highlight your date columns and ensure they are formatted as Date values via the Home tab.
  3. 3. Insert the logic formula: Type =IF(AND(A2>TODAY(), B2>TODAY()), "Valid", "Expired") in your target status cell.
  4. 4. Auto-fill the column: Double-click the fill handle on the cell's bottom-right corner to instantly evaluate all rows.
100% compatibility with Microsoft Excel formulas and the .xlsx format.Built-in error checking to easily identify text-formatted dates.Lightweight, fast, and features a familiar user interface for smooth migration.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my formula return "Expired" even though both dates are in the future?

This usually happens when the spreadsheet reads the dates as text strings rather than numeric date values. To fix this, you can use the 'Text to Columns' feature under the Data tab, or multiply the text cells by 1 to convert them into real serial dates.

What if I only have one date cell to check instead of two?

If you only need to evaluate a single date (for example, in cell A2), you can remove the AND function. The simplified formula would be: =IF(A2>TODAY(), "Valid", "Expired").

How can I automatically highlight the "Expired" cells in red?

You can use Conditional Formatting. Select your results column, go to the Home tab, click 'Conditional Formatting', choose 'Highlight Cells Rules' > 'Text that Contains', enter 'Expired', and select a red fill format.

Can I change the formula to return different text like "Active" or "Inactive"?

Yes, you can customize the output text by changing the words inside the quotation marks. For example, use =IF(AND(A2>TODAY(),B2>TODAY()),"Active","Inactive") to update the status labels.