1 Spreadsheets SELECTION. 2 Aims Understand the principles of selection in Excel Examine the basic...

12
1 Spreadsheets Spreadsheets SELECTION SELECTION

Transcript of 1 Spreadsheets SELECTION. 2 Aims Understand the principles of selection in Excel Examine the basic...

Page 1: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

11

SpreadsheetsSpreadsheets

SELECTIONSELECTION

Page 2: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

22

AimsAims

Understand the principles of selection in Understand the principles of selection in ExcelExcel

Examine the basic IF statement formatExamine the basic IF statement format Look into Nested IF statementsLook into Nested IF statements Examine the basic COUNTIF StatementExamine the basic COUNTIF Statement Understand Boolean conditionsUnderstand Boolean conditions Understand Logical conditionsUnderstand Logical conditions

Page 3: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Btec National - Principles of Software Btec National - Principles of Software DevelopmentDevelopment 33

Selection – The IF StatementSelection – The IF Statement

Selection is all about making decisions.Selection is all about making decisions.

we make decisions all of the time…we make decisions all of the time…

If it’s last orders then buy another roundIf it’s last orders then buy another round If it’s raining then take an umbrellaIf it’s raining then take an umbrella If it is 9:30am then think about going to the 9am If it is 9:30am then think about going to the 9am

lecturelecture

Page 4: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Selection means we are making decisions based on certain criteria that may or may not be the case

If your wallet is empty then you go to the cash point

The decision is do we go to the cash point or not

The criteria is how much money we may or may not have in our wallet

In creating spreadsheets the ability to make decisions is vital.

Page 5: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Btec National - Principles of Software Btec National - Principles of Software DevelopmentDevelopment 55

The IF StatementThe IF Statement

Simple format…Simple format…= If= If ( (conditioncondition, if True , if True ‘execute the code here’, if False ‘execute the code here’)‘execute the code here’, if False ‘execute the code here’)

Page 6: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Btec National - Principles of Software Btec National - Principles of Software DevelopmentDevelopment 66

In the following code…In the following code…

=IF(E9 = "F","Female","Male")

WHAT WHOULD BE THE ANSWER OF THE ABOVE ‘IF STATEMENT’?

Page 7: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Nested ifNested if

=IF(D10 < 10,"Course Cancelled",IF(D10 = =IF(D10 < 10,"Course Cancelled",IF(D10 = 10,"Risky","Course is on"))10,"Risky","Course is on"))

What would be displayed, if the number in D10 What would be displayed, if the number in D10 was any of the following: 1, 10, 11, 54was any of the following: 1, 10, 11, 54

Page 8: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Count IFCount IFSimple format…Simple format…= COUNTIF= COUNTIF ( (RangeRange, Where Condition), Where Condition)

In Excel, the COUNTIF function counts the number of cells in a range, that meets a given criteria.

Page 9: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

In the following code…In the following code…

=COUNTIF(H3:H22,“Y")

What number would be displayed after the COUNTIF has been executed?

Page 10: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Boolean expressionsBoolean expressions

D2 > 18 - D2 > 18 - is D2D2 greater than 18

D2 < 18 - D2 < 18 - is D2D2 less than 18

D2 >= 18 - D2 >= 18 - is D2D2 greater than or equal to 18

D2 <= 18 - D2 <= 18 - is D2D2 less than or equal to 18

D2 =18 - D2 =18 - is D2D2 equal to 18

D2 <>18 - D2 <>18 - is D2D2 not equal to 18

Page 11: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

Logical expressionsLogical expressions

IF(AND(D2 = 16,D14 = 17,if True, if false)) IF(AND(D2 = 16,D14 = 17,if True, if false)) Is D2 equal to 16 AND is D14 equal to 17

IF(OR(D2 = 16,D2 = 17,if True, if false)) IF(OR(D2 = 16,D2 = 17,if True, if false)) - is D2D2 equal to 16 OR equal to 17

- IF(NOT(D2 = 16,True, if false))IF(NOT(D2 = 16,True, if false))- is D2D2 NOT equal to 16

Page 12: 1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.

1212

ConclusionConclusion

Gained some understanding into the principles of Gained some understanding into the principles of selection in Excelselection in Excel

Examined the basic IF statement formatExamined the basic IF statement format Looked into Nested IF statementsLooked into Nested IF statements Examined the basic COUNTIF StatementExamined the basic COUNTIF Statement Gained some understanding into Boolean Gained some understanding into Boolean

conditionsconditions Gained some understanding into Logical Gained some understanding into Logical

conditionsconditions