Excel Formulas & Functions II -...

Preview:

Citation preview

Excel Formulas & Functions IICS101

Topics Covered

• Write 3-D formulas

• Use the IF function

• Use AND/OR criteria

• Use nested IF functions

Logical conditions

• In logic, a sentence or proposition is of the form “If A then B”

A is logical condition

Morgantown Washington D.C.

If taking a flight, then 50 min

If driving, then 3 h 30 min

If walking, then 67 h

Logical conditions

• If a logical condition is satisfied, then we can get the corresponding result defined.

• The different logical conditions lead to different results.

• In Excel, a logical condition is a comparison using mathematical symbols that evaluate to true or false If the comparison is right, the result is TRUE

If the comparison is wrong, the result is FALSE

Comparison Operators

Operator Description

= Equal to

<> Not equal to

< Less than

> Greater than

<= Less than or equal to (at most)

>= Greater than or equal to (at least)

For example, 3 < 5 is TRUE4 > 6 is FALSE9 <= 10 is TRUE8 >= 12 is FALSE

IF function

• The most common logical function is IF function in Excel.

• IF function has three arguments:A logical condition

What to do if condition is met (TRUE)

What to do if condition is not met (FALSE)

= 𝐼𝐹(8 < 10 , "Yes" , "No")Condition What to

show if TRUE

What to show if FALSE

Nested IF function

• Nested means putting an IF function in another IF function.

• Nested IF functions are used to make three or more comparisons.

For example: point is stored in cell A1

A1 = 100 -----> Excellent

A1 = 90 -----> Good

A1 = 50 -----> Bad= 𝐼𝐹(𝐴1 = 100 , "Excellent", 𝐼𝐹(𝐴1 = 90, "Good", "Bad"))

AND function

• AND function requires all logical conditions to be true to return TRUE.

• If one condition is false, then the result is FALSE.

• If all conditions are false, then the result is FALSE.

OR function

• OR function is opposite of AND function.

• As long as one logical condition is TRUE, then the result is TRUE.

• If all conditions are false, then the result is FALSE.

3D formulas

• 3D formulas are used to reference data on another sheet in the same workbook.

For example,

A1 = 100 on Sheet 1

A1 = 200 on Sheet 2

Calculate the sum of these two cells and store the result in A1 on Sheet 3

Insert IF function (1)

• The first way: type the IF function in the cell directly.

• The second way:Click the cell where you want to insert IF

function

View the Formulas ribbon. In the Function Library section, click Logical, and then click IF.

Insert IF function (2)

• In Function Arguments dialog box:Enter Logical_test

Value_if_true: specify what to do if the logical condition is true

Value_if_false: specify what to do if the logical condition is false

• Click OK.

Insert Nested IF function (1)

• The first way: type the Nested IF function in the cell directly.

• The second way:Click the cell where you want to insert

Nested IF function

View the Formulas ribbon. In the Function Library section, click Logical, and then click IF.

Insert Nested IF function (2)

• In Function Arguments dialog box:Enter Logical_test

Value_if_true: you may type an additional IF function here if the logical condition is true (see slide 10 “Insert IF function”)

Value_if_false: you may type an additional IF function here if the logical condition is false (see slide 10 “Insert IF function”)

• Click OK.

Insert AND function (1)

• The first way: type the AND function in the cell directly.

• The second way:Click the cell where you want to insert AND

function

View the Formulas ribbon. In the Function Library section, click Logical, and then click AND.

Insert AND function (2)

• In Function Arguments dialog box:Logical1: enter the first logical condition

Logical2: enter the second logical condition

Logical3: enter the third logical condition when there is one

• Click OK.

Insert OR function (1)

• The first way: type the OR function in the cell directly.

• The second way:Click the cell where you want to insert AND

function

View the Formulas ribbon. In the Function Library section, click Logical, and then click OR.

Insert OR function (2)

• In Function Arguments dialog box:Logical1: enter the first logical condition

Logical2: enter the second logical condition

Logical3: enter the third logical condition when there is one

• Click OK.

Insert 3D formulas (1)

• Click the cell where you want to insert your 3-D formula.

• Type “=”

Insert 3D formulas (2)

• Click the worksheet tab for the first reference.

• Select the desired cell

• Enter the arithmetic operator

Operation Symbol in Excel

Addition +

Subtraction -

Multiplication *

Division /

Insert 3D formulas (3)

• Click the second worksheet for the second reference.

• Select the desired cell

• Press Enter on your keyboard.

• You should have a 3-D reference on the worksheet you started with