// Excel Tutorial

IF, AND & OR Functions

A combination of these three functions can help you write complex decision-making formulas in seconds β€” extracting highly qualified data from any dataset.

🎯
What you'll learn: How to use IF for simple conditions, and combine it with AND / OR for multi-criteria decisions. These three functions together handle the majority of real-world business logic in Excel.

The IF Function

The IF function checks a condition that is either true or false. Based on the result, it returns one value if true, and a different value if false.

=IF(condition, value_if_true, value_if_false)

Worked Example β€” Salary Band Analysis

NameBasic SalaryLess than 5,0005,000 or above
Vipin4,890← IF fills this0
Kaushal5,0000← IF fills this
Krishna5,2340← IF fills this
Udit6,0000← IF fills this
Rahul4,210← IF fills this0

For the "Less than 5,000" column (where B2 is the Basic salary):

=IF(B2<5000, B2, 0)
β€” If salary is below 5000, show the salary; otherwise show 0

For the "5,000 or above" column:

=IF(B2>=5000, B2, 0)
β€” If salary is 5000 or more, show it; otherwise show 0
πŸ“₯
Download the working example file to practice: ifandor.xls  |  ifandor.zip

Using OR and AND with IF

In real decisions, we often have multiple criteria. That is where OR and AND come in β€” they let you test several conditions at once inside your IF formula.

Example Dataset

NameBasicHRA?Telephone?PoorRich
Vipin4,890NY
Kaushal5,000YN
Krishna5,234YY
Udit6,000YY
Rahul4,210NN

Using OR β€” Fill the "Rich" Column

Criteria: If Basic > 5000 OR HRA is given OR has Telephone β†’ "YES", else "NO".

=IF(OR(B2>5000, C2="Y", D2="Y"), "YES", "NO")

Using AND β€” Fill the "Poor" Column

Criteria: If Basic < 5000 AND no HRA AND no Telephone β†’ "YES", else "NO".

=IF(AND(B2<5000, C2="N", D2="N"), "YES", "NO")

OR vs AND β€” Key Difference

FunctionReturns TRUE when…Best used for…
ORAny one condition is metAnyone who qualifies on any benefit
ANDAll conditions must be metPeople who meet every strict criterion
πŸ’‘
Pro tip β€” Nested IF: You can put an IF inside another IF for more levels: =IF(A1>100,"High",IF(A1>50,"Medium","Low")). Excel supports up to 64 levels of nesting.