# If so, then the most scalable package

## If-Then in Excel: This is how the IF function works

In this case it is DAYS function part of the test: The current date is compared with the one specified (in F2) and the difference in the number of days is output. IF checks whether the number is greater than 30. If this is the case, the Then_value one in which you have put a math calculation: a discount is given on the original value (in cell F2). Otherwise the original value is retained.

Of course, you can also include Excel functions in the parameters for then and otherwise. Very popular is z. E.g. the nesting of If-Then in Excel. The disadvantage of IF is that the test only knows two results: True or false. However, if you want to differentiate between several states, instead of Else_Value, an IF function can appear again, which carries out a further check.

In our example, it would be conceivable to give products that are already discounted an even higher discount if there are only a few copies left. With that we have two conditions: The last sale was more than 30 days ago and there are no more than 10 copies in stock. Therefore, on the one hand, we have to include an AND link in the test parameter and, on the other hand, another if-then query in the else parameter, because we want to three results make 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))