0% found this document useful (0 votes)
47 views

Logical Functions - If and or

This document explains logical functions in Excel including IF, AND, and OR. It provides the syntax and examples of how each function works. IF tests a condition and returns one value if TRUE and another if FALSE. AND tests if multiple conditions are all TRUE. OR tests if any of multiple conditions are TRUE. These functions are often used together with IF to perform more complex logical comparisons and conditional formatting in spreadsheets.

Uploaded by

riteshbhu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Logical Functions - If and or

This document explains logical functions in Excel including IF, AND, and OR. It provides the syntax and examples of how each function works. IF tests a condition and returns one value if TRUE and another if FALSE. AND tests if multiple conditions are all TRUE. OR tests if any of multiple conditions are TRUE. These functions are often used together with IF to perform more complex logical comparisons and conditional formatting in spreadsheets.

Uploaded by

riteshbhu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

LOGICAL FUNCTIONS IF / AND / OR

IF
WHY YOU NEED TO KNOW THIS?

Conditional comparisons are used in virtually all spreadsheets


Knowing how to use IF in a nested manner and in combination with other functions will save hours of time

WHAT DOES IT DO?

This function tests a condition


If the condition is met it is considered to be TRUE
If the condition is not met it is considered as FALSE
Depending upon the result, one of two actions will be carried out

SYNTAX

=IF(Condition,ActionIfTrue,ActionIfFalse)
The Condition is usually a test of two cells, such as A1=A2
ActionIfTrue and ActionIfFalse can be numbers, text or calculations

EXAMPLE
B
Name
Shekhar
Gagan
Bala

3
4
5
6

C
Sales
1000
6000
2000

D
Target
5000
5000
4000

E
F
G
H
Result
Not Achieved =IF(C4>=D4,"Achieved","Not Achieved")
Achieved
=IF(C5>=D5,"Achieved","Not Achieved")
Not Achieved =IF(C6>=D6,"Achieved","Not Achieved")

AND
WHY YOU NEED TO KNOW THIS?

Used with the IF function to enable more complicated logical comparisons

WHAT DOES IT DO?

This function tests two or more conditions to see if they are all true
It can be used to test that a series of numbers meet certain conditions
It can be used to test that a number or a date falls between an upper and lower limit
Normally the AND() function would be used in conjunction with a function such as =IF()

SYNTAX

=AND(Test1,Test2)
Note that there can be up to 30 possible tests
When used by itself it will show TRUE or FALSE

EXAMPLE
C
D
Items To Test
500
800
500
25
25
500
12

3
4
5
6
7

E
Result
TRUE
FALSE
FALSE
TRUE

=AND(C4>=100,D4>=100)
=AND(C5>=100,D5>=100)
=AND(C6>=100,D6>=100)
=AND(D7>=1,D7<=52)

OR
WHY YOU NEED TO KNOW THIS?

Used with the IF function to enable more complicated logical comparisons

WHAT DOES IT DO?

This function tests two or more conditions to see if any of them are true
It can be used to test that at least one of a series of numbers meets certain conditions
Normally the OR() function would be used in conjunction with a function such as =IF()

SYNTAX

=OR(Test1,Test2)
Note that there can be up to 30 possible tests
When used by itself it will show TRUE or FALSE

EXAMPLE

3
4
5
6
7

Order No.
K1
K2
K3
K4

Cost
1000
1000
2000
5000

E
F
Payment Handling
Type
Charge
Cash
$0
Visa
$5
Cheque
$0
Mastercard
$5

=IF(OR(E4="Visa",E4="Mastercard"),5,0)
=IF(OR(E5="Visa",E4="Mastercard"),5,0)
=IF(OR(E6="Visa",E4="Mastercard"),5,0)
=IF(OR(E7="Visa",E4="Mastercard"),5,0)

You might also like