The ability to combine or nest functions for advanced data validation in your spreadsheet is one of the google sheet’s powerful capabilities.
‘IF statements’ are finest example of this by which you can examine your data and return different values based on your results. Thus, let’s just learn this skillset through this article.
IF statements evaluate your cells and return the value according to TRUE or FALSE expressions. The syntax or formula fir this statement is –
- logical_expression, means the formula that you are accessing. To compare numbers you can use any of your usual math and comparison operator, or other cell references in your expression.
- value_if_true, this is where you put the value you want to return if your expression returns true.
- value_if_false, it’s an optional parameter, if you leave it blank, your formula will evaluate to FALSE if your expression isn’t true. Similar to the value, if true argument, you may also put a value to return inside quote marks.
Here is an example to show you how IF statement works-
In above example, cell (A2) is being referred to see if it’s greater than 5. The second parameter is set to ‘Yes’ if this expression evaluates to TRUE. The third parameter is set to ‘No’ if expression evaluates to FALSE.
Multiple IF Statement
More than one expression can also be evaluated at once to return different value depending on result. Let’s see how –
Syntax for it is –
IF(logical_expression, value_if_true, IF(logical_expression2, value_if_true2, IF(logical_expression3, value_if_true3, value_if_false)))
This algorithm can be used to connect various IF statements. This works on basis of initial logical expression.
Your formula will return value_if_true if your logical expression evaluates to true. If your logical expression returns a FALSE result then next IF statement will be executed.
And this this how multiple IF statements can be combined and if anone of them returns true, your value if false will be returned.
Let’s ease it out with an example –
Here, four IF statements are layered together. It checks the first expression and returns my desired value if it evaluates to TRUE. If the expression returns FALSE, the program will proceed to the following IF statement.
Using multiple IF statements can get long and tiring. Thus one of the best alternative to it is the IFS function that allows you to check for multiple conditions.
=IFS(condition1,value1, [condition2, value2….]), here
- condition1, is the expression to be evaluated.
- Value1, is the value that can be returned if condition evaluates to TRUE.
- Condition2, value2, is when condition1 evaluates to FALSE then next condition can evaluate and additional values and conditions can be placed here.
An example to describe it better is –
Here’s the case of grading scores. If the first condition is TRUE the formula will stop here; however, if the first condition is FALSE then the formula will continue to examine my subsequent criteria.
And it is where the works gets much easier than the IF statement.
Thus, these two are the powerful functions that must be learnt for easy access and time saving.