22
EXCEL FORMULAS & FUNCTIONS 2 Lingwei Chen [email protected] September 5, 2017 1

EXCEL FORMULAS & FUNCTIONS 2 - cs101.wvu.edu · PDF fileEXCEL FORMULAS & FUNCTIONS 2 Lingwei Chen @mail.wvu.edu September 5, 2017 1

  • Upload
    dothuy

  • View
    227

  • Download
    2

Embed Size (px)

Citation preview

EXCEL FORMULAS & FUNCTIONS 2

Lingwei Chen

[email protected]

September 5, 2017

1

LOGICAL CONDITIONS

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

A: logical condition

2

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

• A: logical condition

– 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

3

LOGICAL CONDITIONS

• For example

– 3 < 5 is TRUE

– 4 > 6 is FALSE

– 9 <= 10 is TRUE

– 8 >= 12 is FALSE

– 8 = 8 is TRUE

– 8 <> 8 is FALSE

4

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)

IF FUNCTION

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

5

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

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 both conditions are false, then the result is FALSE.

6

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.

7

NESTED IF FUNCTION

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

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

8

Cell

A1 = 1Result

Bad

If A1=1, then “Bad”

If A1=2, then “Good”

If A1=3, then “Excellent”

= 𝐼𝐹(𝐴1 = 1 , "Bad" , 𝐼𝐹(𝐴1 = 2, "Good", "Excellent"))

HOW TO INSERT IF FUNCTION

• The first way: Enter the If

function in the cell directly.

• The second way:

– Click in the cell where you want to

insert the function

– Click Formulas ribbon

– In the Function Library section,

click Logical▼

– Click IF function

9

HOW TO INSERT IF FUNCTION

• In Function Arguments dialog:

– Logical_test

Use logical operators

=, <, >, <=, >=, <>

– Value_if_true

What to do if logical condition is

true

– Value_if_false

What to do if logical condition is

false

• Click OK

10

HOW TO INSERT AND FUNCTION

• The first way: Enter the AND

function in the cell directly.

• The second way:

– Click in the cell where you want to

insert the function

– Click Formulas ribbon

– In the Function Library section,

click Logical▼

– Click AND function

11

HOW TO INSERT AND FUNCTION

• In Function Arguments dialog:

– Logical1

Enter the first logical condition

– Logical2

Enter the second logical

condition

– Logical3

Enter the third logical condition

when there is one

• Click OK

12

HOW TO INSERT OR FUNCTION

• The first way: Enter the OR

function in the cell directly.

• The second way:

– Click in the cell where you want to

insert the function

– Click Formulas ribbon

– In the Function Library section,

click Logical▼

– Click OR function

13

HOW TO INSERT OR FUNCTION

• In Function Arguments dialog:

– Logical1

Enter the first logical condition

– Logical2

Enter the second logical

condition

– Logical3

Enter the third logical condition

when there is one

• Click OK

14

HOW TO INSERT NESTED IF FUNCTION

• The first way: Enter the Nested

IF function in the cell directly.

• The second way:

– Click in the cell where you want to

insert the function

– Click Formulas ribbon

– In the Function Library section,

click Logical▼

– Click IF function

15

HOW TO INSERT NESTED IF FUNCTION

• In Function Arguments dialog:

– Logical_test

Use logical operators

=, <, >, <=, >=, <>

– Value_if_true

You may type the additional IF

function here (see slide 9)

– Value_if_false

You may type the additional IF

function here (see slide 9)

• Click OK

16

3-D FORMULAS

• 3-D Formulas are used to

reference data on another

spreadsheet in the same

workbook

• Syntax:

=[name of sheet]![cells to

reference]

17

HOW TO INSERT 3-D FORMULAS

• Click on worksheet tab where

you want to insert your 3-D

formula

• Select the cell

• Type “=”

18

HOW TO INSERT 3-D FORMULAS

• Click worksheet tab for first

reference

• Select desired cell

• Enter arithmetic operator

19

Operation Symbol in Excel

Addition +

Subtraction -

Multiplication *

Division /

HOW TO INSERT 3-D FORMULAS

• Click worksheet tab for

second reference

• Select desired cell

• Press “Enter”

20

HOW TO INSERT 3-D FORMULAS

• You should have a 3-D

reference on the worksheet

you started with

21