8
Distributed by BertoTools.com What is an IF statement? IF(Logical_test , value_if_true , value_if_false) A statement that checks the contents of a cell against a given expression. If the expression is TRUE the first value is returned. If the expression is FALSE the second value is returned.

Excel Spreadsheets If statements

Embed Size (px)

Citation preview

Page 1: Excel Spreadsheets If statements

1Distributed by BertoTools.com

What is an IF statement?

IF(Logical_test , value_if_true , value_if_false)

A statement that checks the contents of a cell against a given expression. If the expression is TRUE the first value is returned. If the expression is FALSE the second value is returned.

Page 2: Excel Spreadsheets If statements

2Distributed by BertoTools.com

Examples of IF Statements

Page 3: Excel Spreadsheets If statements

3Distributed by BertoTools.com

Example 1=IF(A3=A1+A2, “Correct”, “Wrong”)

The Logical_test is A3=A1+A2 i.e. does cell A3 equal cell A1 plus cell A2?The Value_if_true is “Correct” i.e. if cell A3 equals cell A1 plus cell A2 display “Correct”The Value_if_false is “Wrong” i.e. if cell A3 does NOT equal cell A1 plus cell A2 display “Wrong”

Go to Pg 2

Page 4: Excel Spreadsheets If statements

4Distributed by BertoTools.com

Example 2

=IF(A1>A2, “A1 is bigger than A2” , “A2 is bigger than A1”)

The Logical_test is A1>A2 i.e. is cell A1 bigger than cell A2?The Value_if_true is “A1 is bigger than A2”The Value_if_false is “A2 is bigger than A1”

Go to Pg 2

Page 5: Excel Spreadsheets If statements

5Distributed by BertoTools.com

Example 3=IF( AND( ISBLANK(C1), ISBLANK(C2), ISBLANK(C3) ) , “This column is empty” , “This column is not empty” )

The Logical_test is AND( ISBLANK(C1), ISBLANK(C2), ISBLANK(C3) ) i.e. Is cell C1 AND C2 AND C3 empty?The Value_if_true is “This column is empty”The Value_if_false is “This column is not empty”

Go to Pg 2

Page 6: Excel Spreadsheets If statements

6Distributed by BertoTools.com

Example 4=IF( OR( D1=7, D2=7, D3=7) , “There is a seven in this column” , “There is no seven in this column” )

The Logical_test is OR( D1=7, D2=7, D3=7)The Value_if_true is “There is a seven in this column”The Value_if_false is “There is no seven in this column”

Go to Pg 2

Page 7: Excel Spreadsheets If statements

7Distributed by BertoTools.com

Example 5

=IF( AND( E1<=10, E1>=1) , E1 , “This number is too big”)

The Logical_test is AND( E1<=10, E1>=1)The Value_if_true is E1 i.e. It displays the content of cell E1The Value_if_false is “This number is too big”

Go to Pg 2

Page 8: Excel Spreadsheets If statements

8Distributed by BertoTools.com

General Comments We are creating a formula, so we must start

with an equals, = Excel can be very fussy, so we should always

double-check that our brackets and commas match up

Excel only accepts round brackets, ( ) If we want to display text we must use speech

marks, “ ”

Go to Pg 2