What is IF function in Excel?
The IF function is one of the Logical functions of Excel.
It checks whether a condition is met, and returns one value if TRUE, and another value if FALSE.
We can find this function in the Logical category of the insert function Tab.
How to use IF function in excel
1. Click on an empty cell (like F5 )

2. Click on the fx icon (or press shift+F3)

3. In the insert function tab you will see all functions

4. Select Logical category
5. Select IF function
6. Then select ok

7. In Logical_Test section we can enter any value or expression that can be evaluated by True or false
8. In Value_if_true section we can enter What to display if the condition is correct.
9. In Value_if_false section we can enterWhat to display if the condition is wrong.

10. Enter in cells values as shown below:

11. Enter in Logical_Test A2=0
12. Enter in Value_if_true “zero“
13. Enter in Value_if_false “not zero“
14. See result is ok.

15. Enter in Change Logical_Test A3=0
16. See result is not ok.

Examples of IF function in excel
Python code for IF function
Name | Age | Height | Weight |
Olivia | 25 | 210 | 180 |
Noah | 25 | 205 | 235 |
Oliver | 27 | 195 | 205 |
Elijah | 22 | 198 | 185 |
James | 29 | 199 | 231 |
William | 29 | 201 | 240 |
Benjamin | 21 | 202 | 235 |
Lucas | 25 | 200 | 238 |
Henry | 22 | 204 | 190 |
import pandas as pd
data=pd.read_csv(‘example.csv’)
df = pd.DataFrame(data)
arr = df.to_numpy()
if arr[0,0]==’Olivia’:
print(“ok”)
else:
print(“not ok”)
What is the purpose of IF function?
What is the Return value of IF function?
How many arguments does IF function have?
This function has just 1 Argument.
The argument of ABS function is number.
The argument of ABS function is required and not optional.
Which version of excel supports IF function?
This function is available for all excel versions (2003-2019)
Errors in IF function
IF related functions
- COUNTIF function
- SUMIF function
- AND function
- OR function