20
Excel Formulas & Functions II CS101

Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

Embed Size (px)

Citation preview

Page 1: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

Excel Formulas & Functions IICS101

Page 2: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

Topics Covered

• Write 3-D formulas

• Use the IF function

• Use AND/OR criteria

• Use nested IF functions

Page 3: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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

Page 4: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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

Page 5: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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

Page 6: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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"))

Page 7: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 8: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 9: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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

Page 10: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 11: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 12: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 13: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 14: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 15: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 16: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 17: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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.

Page 18: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

Insert 3D formulas (1)

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

• Type “=”

Page 19: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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 /

Page 20: Excel Formulas & Functions II - cs101.wvu.educs101.wvu.edu/media/127896/excel-formulas-functions-ii.pdfExcel Formulas & Functions II CS101. Topics Covered ... •In Excel, a logical

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