Table of Contents
- PURPOSE OF IF IN GOOGLE SHEETS
- PREREQUISITES TO LEARN IF FUNCTION IN GOOGLE SHEETS
- WHAT IS THE SYNTAX OF IF FUNCTION IN GOOGLE SHEETS?
- EXAMPLE:IF FUNCTION IN GOOGLE SHEETS
- KNOWLEDGE BYTES
IF function comes under the LOGICAL FUNCTIONS category in Google Sheets.
IF function is very important and is going to be used a lot which makes it one of the very important functions in Google Sheets.
Its the simplest function to decide on the basis of a given condition in Google Sheets.
IF FUNCTION checks if certain condition is true or not and places a certain value if the condition is true and some other value if the condition is false.
PURPOSE OF IF IN GOOGLE SHEETS
IF FUNCTION ANALYSES THE GIVEN CONDITION AND RETURNS THE FIRST VALUE IF THE CONDITION IS TRUE, OR THE SECOND VALUE IF THE CONDITION IS FALSE.
The values can be a number, text or any other character as per the requirement.
Simply saying, we’ll pass a Condition and two results into this function.
The condition will be checked and the result will be returned on the basis of the outcome of the given condition as per the data passed into the function.
PREREQUISITES TO LEARN IF FUNCTION IN GOOGLE SHEETS
THERE ARE A FEW PREREQUISITES WHICH WILL ENABLE YOU TO UNDERSTAND THIS FUNCTION IN A BETTER WAY.
- Basic understanding of how to use a formula or function.
- Basic understanding of rows and columns in Google Sheets.
- Of course, Google account for Google Sheets login.
WHAT IS THE SYNTAX OF IF FUNCTION IN GOOGLE SHEETS?
The Syntax for the function or the way IF FUNCTION is used in Google Sheets is as shown below.
Enter the function in a cell as
=IF(CONDITION TEST, VALUE IF CONDITION IS TRUE, VALUE IF CONDITION IS FALSE)
All the parameters are necessary.
Use the text output within the double quotes “”.
EXAMPLE:IF FUNCTION IN GOOGLE SHEETS
Suppose we have to find if a person is a KID or ADULT.
A person is a kid if age<18 and an adult if age>=18.
We’ll place it against the person if he is a kid or an adult.
STEPS TO USE IF
The example has 8 persons with ages given in the next column.
We are checking if a person is a kid or an adult.
The formula used is=IF(F7<18,”KID”,”ADULT”)
The output is shown in the picture.
The first phrase is F7<18 which checks if the value present in F7 is less than 18.
If the value is lesser than 18, KID will be put as the result, if not, ADULT.
The output is shown.
NESTED IF IN EXCEL
In many situations we’ll find a case where we will be having more than one condition.
In that case , we can make use of NESTED IF .
The notation goes like this. =IF(condition1, value1,(if(condition 2,value 2, value 3))
if condition 1 is true, value 1 will go otherwise control will go to next condition, if condition 2 is true, value 2 will come else value 3.