Explanation
In this example, the goal is to calculate the time remaining before an expiration date.
This system allows you to perform date arithmetic easily in Excel.
For example, subtracting one date from another yields the number of days between the two dates.
Understanding this date system is important for creating and working with date-related formulas in Excel.
At a high level, the IF function controls the flow of the formula.
This requires a more elaborate formula based on the DATEDIF function.
Luckily, theDATEDIF functionis designed just for this purpose.
If so, we calculate a final result with three separate calls to DATEDIF.
Instead, we are simply calculating a percentage and allowing negative percentage results to pass through.
More than one condition can be tested by nesting IF functions.
The DATEDIF (Date + Dif) function is a “compatibility” function that comes from Lotus 1-2-3.