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:
Other People Are Reading
Click in cell A1 in an Excel worksheet.
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."
Click in cell A2.
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)
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.
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.
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.
Click in cell A3.
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)
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for