IF function in Excel

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 )

empty cell excel

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

 fx icon excel

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

insert logical function tab excel

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.

How to use IF function in excel

10. Enter in cells values as shown below:

if function value excel

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.

examples of if function excel

15. Enter in Change Logical_Test A3=0

16. See result is not ok.

examples of if function excel

Examples of IF function in excel

Python code for IF function

NameAgeHeightWeight
Olivia25210180
Noah25205235
Oliver27195205
Elijah22198185
James29199231
William29201240
Benjamin21202235
Lucas25200238
Henry22204190
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

Leave a Reply

Your email address will not be published. Required fields are marked *