You can use Microsoft Excel to compare dates, such as the current date and an expiration date. Excel treats each individual date and time as a serial number that increases with time. For example, the date June 5, 2023 is a larger serial number than the date June 1, 2023. (See References 1) This allows you to determine whether one date is "greater than," or past another date, such as an expiration date. You can apply this condition to Excel's IF function in the format "IF(condition, value if true, value if false)" and Excel will return a value if it is true or a different value if it is false. (See References 2)

- Skill level:
- Moderate

### Other People Are Reading

## Instructions

- 1
Click in cell A1 in an Excel worksheet.

- 2
Type the expiration date of an item in the format dd/mm/yyyy in which "dd" represents the day, "mm" represents the month and "yyyy" represents the four-digit year. You can use a single digit for the day or month if the day or month contains only a single digit. Press "Enter" when you're done typing. For example, type "6/22/2014" and press "Enter."

- 3
Click in cell A2.

- 4
Type "=TODAY()," which is the TODAY function, and press "Enter." Excel displays the current date, which will automatically update each time you open the worksheet. (See References 3)

- 5
Determine a condition to input in the IF function to test whether today's date is greater than the expiration date. For example, use A2>A1, which tests whether the date in cell A2 is greater than the date in cell A1.

- 6
Determine a value you want Excel to return if the condition in the IF function is true, such as number or text string. For example, use the value "Expired" if the condition is true.

- 7
Determine a value you want Excel to return if the condition in the IF function is false, such as number or text string. For example, use the value "Not Expired" if the condition is false.

- 8
Click in cell A3.

- 9
Type "=" and the IF function with its corresponding arguments, or portions. Place text values you want Excel to display in the "value if true" or "value if false" arguments in quotation marks. Press "Enter" when you're done typing. For example, type "=IF(A2>A1,"Expired","Not Expired")" and press "Enter." Excel tests whether the current date in cell A2 is greater than the expiration date in cell A1 and returns the corresponding true or false value in cell A3. (See References 2)