In this case, the DAYS function is part of the test: The current data is compared with the specified date (in F2) and the difference in the number of days is displayed. IF checks whether the count is higher than 30. If this is the case, the “then_value” where you’ve placed a mathematical calculation occurs: a discount is given to the original value (in cell F2). Otherwise the original value is retained.
Of course, you can also include parameters for then and else. The one drawback of the IF function is that the test only knows two results: TRUE or FALSE. If you want to differentiate between multiple conditions, though, a new IF function can occur instead of the “else_value,” which then performs another check.
In our example, it would be conceivable to give an even higher discount to goods that already have a reduced price if there are only a few of them left. For this, we have two conditions: The last sale took place more than 30 days ago, and there are no more than 10 items in stock. For this reason, we need to place an “AND” link in the test parameter as well as another if-then request in the else parameter, because we want to make three results possible: 50% discount, 25% discount, and no discount.
=IF(AND(DAYS(TODAY();F2>30;E2<10);C2*0,5;IF(DAYS(TODAY();F2;C2*0,75;C2))