If you have worked with Microsoft Excel, you will agree that its IF-THEN function is very impressive. It helps in data analysis and decision-making, especially for those working with financial models. With this function, you will be able to automate many tasks in Excel, increasing your efficiency by a great margin.
In this guide, we will discuss the basics of the IF-THEN function – which can be considered as one of the most important Microsoft Excel skills. After a quick read, you will be able to use this function on your next spreadsheet.
The IF-THEN function’s basic structure is simple:
=IF(logical_test, [value_if_true], [value_if_false])
For example:
=IF(B3>200, “Profit”, “Loss”)
For more complex decisions, you can use multiple conditions These are nested ‘IFs’ that can deal with multiple conditions efficiently. Layering conditions is important for better decision making. The syntax for nested IF is:
=IF(condition 1,IF(condition 2, IF(condition 3, value if condition 3 true, value if condition 3 false), value if condition 2 false), value if condition 1 false)
Explaining the syntax with the example:
If sales >2000, proceed to Layer 2, else “Disappointing”
If margin>20%, proceed to Layer 3, else “Not Satisfactory”
If expense <1000, “Satisfactory”, else “Sale too low”
You can do numerical, text, and date comparisons with the IF-THEN function. Just make sure to follow a logical sequence in each case.
You can add more functions with IF-THEN for better decision making. You can use various financial functions with the IF-THEN function; for instance, NPV () for net present value, PMT () for loan payments, and others. Using these formulae, the business owners can decide whether to invest in a particular item to get good returns, for example.
For large data sets, you can use the array formula. It can speed up large calculations. You can use a single IF-THEN function across many cells, instead of repeating it. Example:
=IF(B1:B10>1,C1:C101.5,”Review”)
This formula multiplies the values of cells C1 to C10 by 1.5 if the values of cells B1 to B10 are greater than one; otherwise, it will display ‘repeat’.
You should first choose the range of cells to display your output. Then write the array formula in the formula bar and press Ctrol+Shift+Enter to apply the formula across the chosen cells.
You can use ‘OR’, ‘AND’, ‘ISEVEN’, and other Excel functions along with IF-THEN as well. Examples:
=IF (AND(B1>50, C1<25), “Profit”, “Loss”)
=If (OR(B1>50, C1<25), “Profit”,”Loss”)
=IF(ISEVEN(B1), “Even”, “Odd”)
In the first formula above, if the value of cell B1 is greater than 50 and that of C1 is less than 25, then display ‘Profit’, else “Loss”. Note that both conditions must be met for ‘Profit’.
In the second formula, if the value of cell B1 is more than 50 or that of C1 is lower than 25, then display ‘Profit’, otherwise ‘Loss’.
The third formula detects whether a number is even or odd with the ISEVEN function.
When writing the IF-THEN syntax you must be very careful because a slight mistake won’t make your formula work. Maintaining clarity in syntax is crucial. You should not have too many nesting levels, as beyond 3 layers the syntax can get confusing.
It is a good idea to space the levels of nesting for better visualization. Additionally, you can add comments to explain the logic you had behind the layers. If you want to learn more complex Excel functions, then the expertly crafted courses at Sikkhon can be the answer.