Download presentation
Presentation is loading. Please wait.
Published byLeon McDaniel Modified over 9 years ago
1
Computer Science 1000 Spreadsheets II Permission to redistribute these slides is strictly prohibited without permission
2
Spreadsheet Computing spreadsheets can be used exclusively for data formatting and layout however, their most common application is to process data what does this mean? in the context of spreadsheets, it means that the spreadsheet provides new information based on what we supply this information can be in the form of data, but also in formatting (e.g. display negative numbers in red)
3
Formula a statement in a cell that performs a computation e.g. math equation, table lookup, etc … every formula has a value the result of the computation this is the value that is displayed the formula itself will be displayed in the formula bar formulas can be combined indicated by an initial = sign in other words, when the data in a cell begins with =, Excel interprets the remainder to be a formula
4
Formulas - Constant constant: a formula whose value is itself examples include: numbers text dates by themselves, constants are not typically expressed as a formula they are usually used in other formulas
5
Numeric Constant a number
6
Numeric Constants by themselves, numeric constants aren’t that useful as formulas they have the same functionality outside of formula instead, they are usually used as part of another formula these include: numeric operators function inputs
7
Numeric Operators Excel accepts the standard math operators +, -, * (times), / (divide), ^ exponent these operators are used in typical binary format e.g. to compute 3+4, enter the formula =3+4
8
Numeric Operators Question: what happens if I omit the equal sign? Excel interprets the formula as text, as it cannot be interpreted directly as a number or a date (due to the + in the middle). Remember to use = when using formulae.
9
Numeric Operators Question: what happens when I combine operators? Excel honours the order of operations that you are used to: highest: ^ next: * / lowest: + -
10
Numeric Operators Question: suppose I want to perform operations out of order (e.g. perform the add before the multiply)? Use parentheses to reorder your operations. Operations in parentheses have the highest priority.
11
Numeric Operators Example: compute the average of 1,2,3 and 4. Use parentheses to perform the addition before the division.
12
Numeric Operators Example 2: Recall our transaction spreadsheet. We used all numeric constants. Use formulas to compute the final three amounts:
14
Text Constants text can also be used as a constant in a formula however, not as simple as putting the text after the = sign Whenever you see a computed value that starts with #, it often indicates an error. In this case, Excel does not know that Kev is meant to be text
15
Text Constants when text constants are used in a formula, enclose them in double quotes
16
Text Concatenation like numeric constants, not often used by themselves can be used in concatenation – combine multiple text elements into a single version use the operator &
17
Text Concatenation when using concatenation, you must specify all of the characters you want to appear a common mistake is to forget about spaces
18
Mixing Types what happens when we do the following? Excel will attempt to convert the values based on the operator type. In this example, because & accepts two text items, it converts 1000 to “1000”
19
Mixing Types what happens when we do the following? In this example, because + accepts two numbers, it converts “4” to 4
20
Mixing Types what happens when we do the following? In this example, because - accepts two numbers, it tries to convert “CS ” to a number. Since this fails, an error is generated.
21
Mixing Types - Precedence question: what’s the output of the following? The & operator has lower precedence than all of the math operators. Hence, the formula is parsed as: “1” & ( “2” – 4 ) “1” & -2 “1” & “-2” “1-2”
22
Functions a preset formula in Excel each function has a name functions accept a set of zero or more inputs surrounded by parentheses separated by commas a function has a value usually, the function performs some computation, and its value is the result of that computation
23
Function - First Example suppose you want to know the square root of a number Excel has a function called sqrt accepts one input – a value or formula
24
Function - Inputs note that the input to a function can be another formula, if you like the inside formula is evaluated before its value is sent to the function
25
Function - Inputs the input to a function can even be another function the inside function is evaluated first its value is sent as the input to the outside function
26
Function - Inputs your function will expect a particular type as its input will convert if necessary
27
Function - Inputs your function will expect a particular type as its input an error occurs if it can’t convert
28
Functions – No Input some functions have no inputs they always return the same value the parentheses are still required, to indicate that it’s a function nothing is placed inside e.g. pi() - returns the value π
29
Functions – Example compute the volume of a cylinder of radius 10.4 and height 25.6 Formula: V = πr 2 h
30
Functions – Example spot the error in the formula pi is a function, and hence must have parentheses to indicate this
31
Functions – Multiple Inputs some functions accept more than one input each input should be separated by commas example: max returns the maximum value amongst all of its inputs
32
Functions – Multiple Inputs not all inputs need to have the same type e.g. left left accepts a text input S, and a number X, and returns the first X characters in S
33
Boolean Values a type that can be one of the two following values: TRUE FALSE think of it like yes (TRUE) or no (FALSE) these values can be on their own, or in a formula
34
Boolean Values some function inputs require boolean values e.g. vlookup (from your lab) the last parameter indicates whether the value you are looking can be an approximate match approximate: TRUE exact: FALSE
35
Boolean Values instead of specifying Boolean values, they are often computed this is done using comparison operators = (equal) <> (not equal) < (less than) > (greater than) <= (less than or equal to) >= (greater than or equal to)
36
Comparison Operators can be used on text types can be used on mixed types
37
If Statement one of the most useful functions in Excel takes three inputs a Boolean value remember: can be a formula that returns a Boolean a “True” value the value of the function if the first input is true a “False” value the value of the function if the first input is false in other words, it selects either the second or third input as its value, depending on whether its first input is true or false
39
If Statement remember: any of the inputs can be formula themselves Since 3 < 4 is true, the value of this formula is the second input, or sqrt(16)
40
If Statement remember: any of the inputs can be formula themselves Since 3 > 4 is true, the value of this formula is the third input, or max(6,7)
41
Excel Functions there are many functions built into Excel Math abs – returns the absolute value of its input sin, cos, tan – returns the sine/cosine/tan value of its input average – returns the average value of its input
42
Excel Functions there are many functions built into Excel Text len – returns the number of characters in its input string lower – converts all characters in its input to lower case upper – converts all characters in its input to upper case
43
Excel Functions – Help Excel has a handy feature that assists users in function recall clicking on the formula bar label will activate a dialog that lists all of the functions available in Excel this includes a categorization, and a search feature
45
Excel Functions – Help furthermore, selecting a function from this list shows a dialog with a place to insert each input, with a description of what it does
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.