Excel functions provide the enormous benefit of helping us automate the results of different operations, even at the logical level.. The latter refers to the fact of being able to analyze a value with the purpose of determining if any previously stated condition is met. For example, if you have a list of students with their respective grades, you could enable a cell where they are verified in order to know if they have been approved or not. If you need to use an alternative like this, you have come to the right place because we are going to show you how to use the If function in Excel.
It is a formula that, due to its work in logical operations, could be intimidating and presented as difficult to use. However, it is the opposite and here we are going to demonstrate it with a practical example to understand it better.
What is the If function in Excel for?
Earlier, we mentioned an example where we analyzed a value to determine if a student's grade is passing or not. This is one of the thousands of scenarios in which we can use the If function in Excel and if you use the tool frequently, it is certain that you have a document in which you can take advantage of it.
For example, not only do we have the possibility to analyze a number to know if it is in a specific threshold or not, we can also compare two cells and determine if there are matches. This is very useful in scenarios where you need to validate the presence of the same data in two Excel sheets or workbooks. It will suffice to resort to the If function and enter the matches we are looking for among the parameters.
Next, we are going to show you all the steps to follow and previous considerations to use the If function in Excel successfully and without complications.
Steps to use the Yes function
Comparison operators
The If function in Excel works through the use of so-called comparison operators. and knowing them will allow us to know what tools we have to carry out the processes we need with this formula. The logical operators are the following:
- Same as: =
- Greater than: >
- Smaller than:
- Greater than or equal to: >=
- Less than or equal to: <=
- Different from: <>
The previous list has all the comparisons or analysis that we can do figures and values in any Excel cell. The only established rules for using these operators are those that establish the syntax of the function, so you can completely adjust them to what you need, as long as you comply with the above.
If Function Syntax
We already know what are the possible comparisons or analyzes with the If function in Excel, now we are going to review its syntax. The syntax refers to the elements that make up the function and the order in which they must be raised for Excel to understand it and perform the calculation.. In the case of the If function, the syntax is this:
=IF(Logical Test, Value if true, Value if false)
This means that, after the parentheses, we must enter:
- logical proof: This is nothing more than the comparison that we want to make, that is, if a given cell is equal to, greater than, less than, or different from another or from a specific value.
- value if true: refers to what will be displayed in the cell if the condition is met.
- value if false: is what will be displayed in the cell if the condition is not met.
Example of using the If Function
Now, if we take it to a more practical example, we are going to return to the example we discussed at the beginning, where we have a list with students and grades. We want to have a room where the qualification in question is analyzed and it is indicated if it has been approved or not based on 100 points, with 50 being the passing grade.
To do this, click on a cell and then enter:
=YES(E7>=50, «Yes», «No»)
Replace E7 with the cell where the grade is found in your case. At the end, and pressing Enter, the result will be displayed immediately. The rest will be to drag the formula to the other cells so that the information we want to obtain automatically is displayed. This is all you need to use the If function in Excel in these types of scenarios.
Conclusion
As we have seen, the if function in Excel is extremely useful in many different scenarios. In this sense, it is a formula that we must know and handle perfectly if we need to interact with Excel very frequently in our daily work. The comparison operators, being well applied in this function, will save you a lot of time and will allow you to have more useful and versatile spreadsheets.