- A Basic Example of IF()
- An IF() Example That Does Calculations
- 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:

=IF(condition,what_happens_if_true,what_happens_if_false)

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.

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:

=IF(F2=TRUE,"$4,000/month","$20.00/hr")

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:

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:

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:

Suscribe to get more data and analytics tips!

Thank you! Your submission has been received!

Oops! Something went wrong while submitting the form.