In this video, I will show you the type of functions that are known as logical functions. It means that before we perform any type of calculations, there is a condition that should be checked, and only that, all the calculations should be performed. We will begin with the function IF; it is one of the main logical functions. The structure of that function is the following. If in the brackets in the first place, we write the condition, and if that condition is true about the cell, then after the comma is the value that the function should return. It means we'll type in the cell when the function is written. If the condition is not true, after another comma, there is a value that should be returned if the condition is false. To practice a function, let's create a new column that will show if a passenger has any siblings or a spouse or parents or not. It means that would be a flat column. Let's return to the shape with the data and create it. This column should have name, and my choice would be seen as bad FOG. I mean, the same name as the original column has, but with the little sign that it is something new, and we will start filling that column with the function IF. If the passenger has more than zero siblings or spouses, then type one. If he does not or she does not return zero. Here we have the result. As you can see, the Google Sheets interface recommends us to use autofill to stretch the formula until the end of the dataset. I will agree with that suggestion and after that, here is the column with the new information with a flag that a passenger has a sibling or does not have siblings or spouses on the liner. This was one way of using IF function. There's another. You can nest a function inside IF function and perform more sophisticated conditions inside the IF function. For example, let us create a column that shows if a passenger has any type of relatives on the liner. Either siblings, either spouse, either parents, either children. We should gather information from two columns to create a new one. Again, choose a space, name a column. I will name it for example, relatives, FOG and here, again start with IF statement. In first place we should write down the condition. This time, it would be a more complex and to write it down, I will use another logical function. Or I will return one if a passenger has either siblings or spouse on the board, or parents or children. It means that either in the column F, the value is more than 0 or in the column G value is more than 0. Then if one of that conditions is true, I will return one. If not, if both are false, then I will return zero. Again, the interface suggests the autofill option, which I choose two. Here we have a column, if a person has any type of relative, it is one in this column and he is alone, then it is zero in this column. Of course, you can write down the same expression in a more complex way. In some cases it might be useful, that's why I would show you. To get the same column, it is possible to write it as sequence of conditions. For example. Start with IF a passenger has siblings or spouse, then one, he has at least one type of relative on the liner. If the first condition is not true, then look at the other column with another IF statement that is nested in the main IF function. IF number of parents and children more than zero, again return one. If this condition is not true, then return zero. Close the nested IF function, and then close the IF function, the main one. Again, auto-fill and you see the results. The results of these two columns N and O is the same. These are just two different ways to create the same column that also might be useful in your future analysis of any tasks. There is also a combination of logical AND statistical functions. Together, they can bring us to some new conclusions. In the previous videos, we have studied the function count. Now, I will show you the function COUNTIF, so you can count something with a specific condition. For example, we know that in my data set that I'm showing to you right now, there're 418 rows, it means 418 passengers. How many passengers are there on the board with siblings or a spouse? Let's calculate that number. For that reason, we will need the function COUNTIF. The usage is quite simple, we need to select the range. Here it is. Then write down the condition. The condition is simple event, it is more than zero. Close the brackets. No need for auto-fill right now. Here it is, that number 135. It means that 135 out of 418 people on the board have siblings or spouses on the liner. Another example of combination of statistical and logical functions is AVERAGEIF. Last time we have calculated the average number of siblings on the liner. What if there is a difference in that number if a person has parents or children on the board or not? Let's calculate that numbers for different type of people. Here we start with the AVERAGEIF. On the first place we choose the range as where we should check the condition. After that, we write down that condition. We will start with the people who have parents or children on the board. We have chosen the range for the condition. We write down the condition. Now, we should select the range where to calculate the average. That is the column F. It is 1.1. Now, we will calculate the number of siblings if a person does not have parents or children on the board. Again, AVERAGEIF. Choose the range for the condition, write down after the comma, that condition. Then select the range where we should find the average number. This time, that number equals to zero point, almost 26. It means that people who have parents or children on the board, on average have more siblings on the board as well. There's another function of the same type, which is called SUMIF. It works in the same manner as AVERAGEIF, but instead of averaging the column, it is summing up the numbers that are in the column. Of course, this is not the full list of logical functions that can be performed in the Google Sheets. For more, you can Google the documentation and find other logical functions.