1 Spreadsheets SELECTION. 2 Aims Understand the principles of selection in Excel Examine the basic...
-
Upload
cameron-horn -
Category
Documents
-
view
220 -
download
3
Transcript of 1 Spreadsheets SELECTION. 2 Aims Understand the principles of selection in Excel Examine the basic...
11
SpreadsheetsSpreadsheets
SELECTIONSELECTION
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
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
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.
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’)
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’?
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
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.
In the following code…In the following code…
=COUNTIF(H3:H22,“Y")
What number would be displayed after the COUNTIF has been executed?
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
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
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