September 15, 2020

Simple Guide To Using The IF() Function in Google Sheets

Chart with arrows pointing up and down
  1. A Basic Example of IF()
  2. An IF() Example That Does Calculations
  3. Nesting IF() functions

In this tutorial, we will learn the basics of an important function used in Google Sheets: the IF() function. The IF() function has the general format:


Both what_happens_if_true and what_happens_if_false can either display a simple statement or contain a calculation to be done by Google Sheets once the conditions are met. Thus, the IF() function allows for more freedom to the user to program to the spreadsheet what is necessary. 

A Basic Example

Let’s say we want to specify the salary of the employees depending on whether they are full-time or part-time employees. We can set a cell to be a checkbox, and then set another cell to display the corresponding salary. The formula we use is as follows:


This formula will display the monthly salary of the employees if they are full-time employees or their hourly wage if they are part-time employees. You can see it at work below:

IF() function at work.

An Example That Does Calculations

Let us have a more complex example, the one that does calculations inside the IF() function. We want to check if those who are not yet full-time employees are now eligible for full-time salary because they have been working for more than 4 years. We then construct it first as follows:

=IF((YEAR(NOW())-*cell*)>=4,"Eligible for Full-Time","Not Yet")

Then, we fill in *cell* as the cell where the year is located, which is L15 in this case:

IF() function also calculating.

Nesting IF() functions

Sometimes there are cases where we have to have a lot of conditionals. To solve this, we can insert an IF() function inside another one. Let us improve our previous formula by adding a way to display whether the employee is already a full-time employee. We add the following statement:

=IF(F2=TRUE,"Already Full-Time",*insert-previous-function*)

Then, we insert our previous IF() formula above in the space where *insert-previous-function* is located. The whole formula would look like this:

=IF(F2=TRUE,"Already full-time",IF((YEAR(NOW())-L2)>=4,"Eligible for Full-Time","Not Yet"))

Here, F2 and L2 are the cells containing relevant information, so make sure to replace them if you want to replicate it. The result can be seen below:

Nested IF() function example

Suscribe to get more data and analytics tips!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.