Continues with Excel basics giving information on cell addressing styles and worksheet functions and their nesting. Also gives an example of precision setting
2. Presentation Topics
• Cell Referencing
• Moving and Copying Formulas
• Cell Referencing by Name
• Worksheet Functions
• Function Categories
• Function Examples
• Setting Precision for Calculations
• Dealing with Errors
3. Cell Referencing
• Two Styles of Referencing
– A1 vs. R1C1 Notation
• The A1 notation is the commonly used cell referencing notation in
Excel. This is the notation we have been using and will continue to
use. However, Excel also supports another notation, known as
R1C1 notation.
• In R1C1 notation, a cell is specified by two numbers: Row number
and Column number. Thus, cell A2 will be referenced as R2C1,
meaning its R number is 2 and C number is 1. Similarly, cell B2 will
be referred as R2C2. Some more examples are:
• C3 as R3C3
• B4 as R4C2
• D6 as R6C4
4. Range Referencing
• A range of cells in Excel
implies a rectangular
group of contiguous cells
• Specify by referencing the
top left cell in the range,
followed by a colon, and
the bottom right cell.
A11:B14
B3:D8
5. Referencing Cells on Other Sheets in the Same Workbook
• You can refer to cells in other worksheets in the same
workbook. This is done by inserting the sheet name followed
by an exclamation mark (!) before the usual cell reference
• Some examples are:
– Sheet2!A3 references cell A3 of worksheet 2
– The formula =A2+Sheet2!B2+Sheet3!C2 adds cell A2 of the
active sheet with cell B2 of Sheet2 and cell C2 of Sheet3
– The formula =Sheet2!B2*Sheet3!A3 multiplies cell B2 of
Sheet2 with cell A3 of Sheet3
• You can also refer to cells on worksheets in other workbooks.
Such References to cells in other workbooks are called
external links and the referenced workbooks are called linked
workbooks or files.
6. Referencing Cells From Other Workbooks
• When you refer to a cell or a group of cells in another
workbook, the referenced workbook is called the source
workbook. The workbook making the reference is called the
destination workbook.
• [Bills.xlsx]Sheet2!B1 refers to cell B1 of sheet 2 in the
workbook named Bills.xlsx. The workbook Bills.xlsx in this case
is the source workbook. This will work only when the source
workbook is open.
• If the source workbook is closed, then the complete path to
the source workbook file must be given. For example:
– 'C:Personal[Taxes.xlsx]Sheet1'!E10
– Note that the path reference to the closed workbook is enclosed
within single quotation mark
7. Relative and Absolute Cell Referencing Modes
• Cell references such as A1 represent relative
referencing mode. When a formula containing
relative referencing is copied, the references in
the copied formula are automatically adjusted.
– Example: Suppose the formula =A1+B1 is entered in
cell C1. Next, the formula is copied into cells C2 and
C3. Excel will automatically adjust the formula in C2
as =A2+B2, and in C3 as =A3+B3
– If we copy the formula =A1+B1 into cell G1, it will be
adjusted to =E1+F1 because the position of cell E1
relative to cell G1 is identical with that of cell A1 with
C1. The same is true for F1’s relative position being
identical to that of cell B1
8. Relative and Absolute Cell Referencing Modes
• Cell references such as $A$1 represent absolute
referencing. When a formula containing absolute
referencing is copied, the cell references in the
copied formula do not change.
– Example: Suppose the formula =$A$1+$B$1 is entered in
cell C1. Next, the formula is copied into cells C2 and C3.
Excel will keep the formula cell references unchanged.
Thus, the formula in C2 will appear as =$A$1+$B$1, and
C3 will show the same
• You can mix absolute and relative referencing. For
example, you can specify a cell reference as $A1.
This is called column absolute. Similarly you can
have row absolute referencing as in A$1
9. Moving and Copying Formulas
• Excel behaves differently when you cut and
paste a formula than when you copy and paste
a formula
When you cut and paste a formula,
the effect is that of moving the
formula. No updating of cell
references in the formula takes place
10. Paste Button Options
• Paste or Formulas option
implies pasting the copied
formula
• Paste Values option causes
the formula result to be
pasted instead.
• Paste Link option implies
that the formula result will
be pasted but Excel will
update the result if the
result of the formula in the
source cell changes
11. • The AutoFill feature of Excel
allows you to enter a series of
numbers, months, and days in
consecutive cells
• To use this feature, you must fill
in two consecutive cells to let
Excel know the pattern for
AutoFill
• The filling takes place when you
select the first two cells of the
series and drag the fill handle
over the cells you want to fill
• The AutoFill feature is also used
for copying a formula
AutoFill Handle
AutoFill Feature
12. Fahrenheit (F) to Celsius (C) Conversion
Degree in F Degrees in C
20 -6.7
• Enter 20 and 40, respectively
in cells A3 and A4. Select cells
A3 and A4 and drag the fill
handle over cells A5:A9
• Enter the formula for
temperature conversion in cell
C3. The formula is =(A3-
32)*5/9. Note A3 is
representing temperature in
Fahrenheit that is being
converted.
• Now select cell C3 and drag its
fill handle over C4:C9 to
generate a table of equivalent
temperatures
Temp in Celsius =(Temp in Fahrenheit -32)*5/9
AutoFill Example: Temperature Convertor
13. Relative and Absolute Referencing Example
• Create a multiplication table where the cells in blue show the result of multiplying a
pair of numbers. The numbers in each pair are taken from yellow cells along the
respective rows and columns.
• In cell B2, enter the formula =$A2*B$1. The formula has mixed referencing because
numbers in the multiplication formula remain the same along columns and rows,
respectively.
• Copy the formula along rows and columns to fill the table.
1 1 2 3 4 5 6 7 8 9
2
3
4
5 15
6
7
8
9
10 10 20 30 40 50 60 70 80 90
Column Absolute
Row Absolute
14. Multiplication Table: Formulas View
• The formula view shows the formulas that are automatically entered
by Excel in each cell upon copying the formula of cell B2. You can note
how a number in each pair of multiplicands remains same either
along each row or column
• See what will happen if you used only relative referencing in B2 and
then copied the formula to other cells
1 1 2 3 4 5 6 7 8
2 =$A2*B$1 =$A2*C$1 =$A2*D$1 =$A2*E$1 =$A2*F$1 =$A2*G$1 =$A2*H$1 =$A2*I$1
3 =$A3*B$1 =$A3*C$1 =$A3*D$1 =$A3*E$1 =$A3*F$1 =$A3*G$1 =$A3*H$1 =$A3*I$1
4 =$A4*B$1 =$A4*C$1 =$A4*D$1 =$A4*E$1 =$A4*F$1 =$A4*G$1 =$A4*H$1 =$A4*I$1
5 =$A5*B$1 =$A5*C$1 =$A5*D$1 =$A5*E$1 =$A5*F$1 =$A5*G$1 =$A5*H$1 =$A5*I$1
6 =$A6*B$1 =$A6*C$1 =$A6*D$1 =$A6*E$1 =$A6*F$1 =$A6*G$1 =$A6*H$1 =$A6*I$1
7 =$A7*B$1 =$A7*C$1 =$A7*D$1 =$A7*E$1 =$A7*F$1 =$A7*G$1 =$A7*H$1 =$A7*I$1
8 =$A8*B$1 =$A8*C$1 =$A8*D$1 =$A8*E$1 =$A8*F$1 =$A8*G$1 =$A8*H$1 =$A8*I$1
9 =$A9*B$1 =$A9*C$1 =$A9*D$1 =$A9*E$1 =$A9*F$1 =$A9*G$1 =$A9*H$1 =$A9*I$1
10 =$A10*B$1 =$A10*C$1 =$A10*D$1 =$A10*E$1 =$A10*F$1 =$A10*G$1 =$A10*H$1 =$A10*I$1
15. Creating a Table Calculating Area of a Right Angle
Triangle Given Base and Height
2 4 6 8
2
5 =4*5/2
8
11
16. Using Names for Cell Referencing
• Excel permits a cell or a range of cells to be
assigned a name which can be then used in a
formula. The main advantage of this Excel
feature is that it makes easy to understand the
calculations being done by a formula
Income = Revenue - Expenses
C1 = A1 – B1 Vs.
17. How to Create and Use Names?
• Select a cell or range
• Click Name box
• Type the name we want to use in the Name box and press
Enter
• Naming rules
– No spaces are allowed within a name. Use an underscore (_) symbol to
avoid spaces
– A name must begin with a letter or underscore
– Numbers can be included but not at the beginning
– Not case sensitive. So “base” or “BASE” or “Base” are all considered
same
18. Example: Name Use for Triangle Area
Worksheet for Calculating the Area of a Right Angle Triangle Table
5 10 15 20
4
8
Triangle 12
Base 16
Triangle Height
20. Worksheet Functions
• A worksheet function is a series of complex
calculations that come packaged with Excel.
• The details of the calculations performed by a
function are hidden from the user.
• Excel provides over 300 worksheet functions that
make it easy for users to perform complex
calculations for a variety of applications
• We can also write custom functions using Visual
Basics for Applications (VBA ) in those situations
where Excel does not have an appropriate function.
21. Parts of a Worksheet Function
• A worksheet function has two components: a name and a list of
arguments enclosed in a pair of parentheses as shown in some examples
below
SUM(A1, A2, A3)
MAX(B1, B2, 5)
SQRT(A5)
SUM(B1:B10)
• Arguments are constants, cell addresses or ranges, or other functions or
arithmetic expressions
• A worksheet function either appears by itself as a formula or as a part of a
formula as shown in some examples below
=AVERAGE(B1:B8)
=SUM(A1:A5)/5
=10 – SQRT(A2)
=SUM(A1, A2-2,A3*A4)
22. Worksheet Functions (Continued)
• Different functions require different
arguments. For example, the RAND function
has no argument. SQRT has one argument,
and you can have up to 255 arguments for
many functions such as SUM and AVERAGE
• When entering functions, make sure you do
not put space between the function name and
the opening parenthesis of the argument list
23. Entering Functions in Formulas
• By manually typing the function name and its
arguments. When entering manually, Excel
helps you by Formula AutoComplete feature
24. Insert Function Dialog Box
• You can also enter function through the Insert
Function dialog box
• The dialog box appears when you click the
Insert function button in the Formula bar or in
the Ribbon when Formulas tab is active
26. Function Nesting
• Nesting means using one or more functions as
arguments of other functions. Two examples of
nesting are shown below
=SUM(A1,SUM(A2,SUM(A3:A5)))
=AVERAGE(SUM(A2,SQRT(A3*A5)), MAX(A1,A2,5))
27. Function Categories
• Excel has 12 different categories of
functions. Many of these categories are
shown in the Ribbon when Formulas tab
is active
28. Common Function Examples
• AVERAGE(number1,number2,…)
Returns the average of its arguments
• ABS(number)
Returns the absolute value of its argument
• SQRT(number)
Returns the square root of a number
• SUMSQ(number1,number2,…)
Returns the sum of the squares of the arguments
29. More Function Examples
• ROUND(number,num_digits)
Rounds a number to the specified number of digits after
the decimal point.
=ROUND(4.6737,0) 5
=ROUND(4.6737,1) 4.7
=ROUND(4.6737,2) 4.67
=ROUND(4.6737,3) ?
30. More Function Examples
• CEILING(number,significance)
Rounds a number up, to the nearest integer or to the
nearest integer multiple of significant.
=CEILING(4.67,1) 5
=CEILING(4.67,2) 6
=CEILING(4.67,.25) 4.75
=CEILING(4.67,3) ?
6 is the nearest integer to
4.67 that is divisible by 2
4.75 is the nearest integer
multiple of 0.25 greater than
4.67.
6
FLOOR(number, significance) behaves similarly
except that it goes for a smaller number
31. More Function Examples
=FLOOR(4.67,1) 4
=FLOOR(4.67,2) 4
=FLOOR(4.67,.25) 4.50
4 is the nearest integer less
than 4.67 that is divisible by
2
4.50 is the nearest integer
multiple of 0.25 less than
4.67.
FLOOR(number, significance) behaves similarly
to the CEILING except that it goes for a
smaller number
32. More Function Examples
• INT(number)
Rounds a number down to the nearest integer.
=INT(4.87) 4
=INT(4.13) 4
=INT(5/3) 1
=INT(5/2) ? 2
33. More Function Examples
• MOD(number,divisor)
Returns the remainder after division.
=MOD(4,3) 1
=MOD(4.13,3) 1.13
=MOD(5,3.3) 1.7
=MOD(14,7) ? 0
34. More Function Examples
• QUOTIENT(numerator,denominator)
Returns the quotient of a division.
=QUOTIENT(6,3) 2
=QUOTIENT(4.13,3) 1
=QUOTIENT(35,10) 3
=QUOTIENT(19,5) ? 3
36. Illustrative Example: Calculating Distances
• We are given a worksheet with five pairs of
points. Each point is represented by two
values, the X and Y coordinates
• The goal is write formulas using suitable
worksheet functions to calculate distances
between each point pair
• Three different distance measures are to be
used for each pair
37.
38. Distance Measures
• Euclidean distance
– This is the common distance measure we use
between two points. It measures the length of the
line joining the two points
– The formula for the Euclidean distance is
Euclidean Distance (Point 1, Point 2) = [(x1-x2)2 + (y1-y2)2]1/2
P1
P2
39. Distance Measures(2)
• City Block distance
– This measure uses the length around the city
blocks as you go from one point to another.
– The formula for the City Block distance is
City Block Distance (Point 1, Point 2) = |(x1-x2)| + |(y1-y2)|
P1
P2
40. Distance Measures(3)
• Chess Board distance
– This measure treats points as positions on a chess board.
The minimum number of valid chess moves needed to go
from one point to another is treated as the distance
between two points
– The formula for the Chess Board distance is
Chess Board Distance (Point 1, Point 2) = Max (|(x1-x2)|, |(y1-y2)|)
P1
P2
Or
42. Writing Formulas for Distance Calculations Worksheet
• We will use names in place of cell references
• We will assign names using the Define Name
button in the Formulas tab
43. Using the Define Name Button
• Select the cells you want to name. We select B1:B6
• Click the Define Name button
• Enter the name in the New Name dialog box. We will
enter XCORD1
• Repeat for other groups of cells
44. Distance Calculation Formulas
• For Euclidean distance (Cell F2), and copied to
F3:F6
=SQRT(SUMSQ((XCORD1-XCORD2), (YCORD1-YCORD2)))
• For City Block distance (Cell G2), and copied to
G3:G6
=ABS(XCORD1 - XCORD2) + ABS(YCORD1 - YCORD2)
• For Chess Board distance (Cell H2), and copied
to H3:H6
=MAX(ABS(XCORD1 - XCORD2), ABS(YCORD1 - YCORD2))
46. Another Example: Returning Exact Change
• We have a worksheet with column A showing the
amount to be returned as change
• The change is returned using the minimum number
of one dollar bills, quarters, dimes, nickels, and
pennies. For example, change of $2.27 will be
returned with two one dollar bills, one quarter, and
two pennies
47. FLOOR Function Recapped
• We will solve the exact change problem using the FLOOR
function. It is also possible to use other functions, for example
the INT function to solve it
• Why FLOOR function?
– Because it rounds a number down to the nearest integer or to the
nearest integer multiple of significance
=FLOOR(2.27,1) 2 (Two one dollar bill)
=FLOOR(0.27,0.25) 1 (One quarter)
=FLOOR(0.02,0.01) 2 (Two pennies)
48. Exact Change Formulas
• Cell A4 has the change amount
• The number of one dollar bills needed is calculated in cell B4
using the formula
=FLOOR(A4,1)
• The number of quarters is calculated in cell C4. The formula is
=FLOOR(A4-B4,0.25)/0.25
• Similar formulas for dimes, nickels, and pennies in cells D4:F4
are
=FLOOR(A4 – B4 – C4*0.25, 0.10)/0.10
=FLOOR(A4 – B4 – C4*0.25 – D4*0.10, 0.05)/0.05
=(A4 – B4 – C4*0.25 – D4*0.10 – E4*0.05)/0.01
50. Setting Precision for Calculations
• Some times you will find Excel returning incorrect answers in
cases where arithmetic operations on extremely small
quantities are performed. You might encounter such a
situation in your exact change worksheet for certain amounts
• As another example of getting an unexpected result, consider
the following formula
=1*(.5-.4-.1)
You would expect Excel to return 0 as the result. However, Excel will
return the result as -2.78E-17, which is the scientific notation for -
0.0000000000000000278 .
• The reason for above and similar results in Excel is how it
internally represents the fractional numbers. Such errors are
known as rounding errors
51. Dealing with Rounding Errors
• We deal with rounding errors by setting precision, a
measure that tells Excel the level of accuracy we
desire in our calculations
• You can control precision in two ways
– Using the ROUND function. For example, round off the
calculations by replacing the formula =1*(.5-.4-.1) with
=ROUND(1*(.5-.4-.1),2). This rounds off results to two
decimal places
– Using the Excel Options button. Here select the Advance
category and then When calculating this workbook
section, and then checking the Set precision as displayed
box
52. Setting Precision in the Exact Change Worksheet
• You can avoid rounding off errors by setting precision
to two decimal places as we are dealing with money
here. You can do so by using the following formulas
for nickels and pennies
=FLOOR(ROUND((A4 - B4 - C4*0.25 - D4*0.1),2), 0.05)/0.05
=ROUND((A4 - B4 - C4*0.25 - D4*0.1 - E4*0.05),2)/0.01
53. Dealing with Errors
• Excel provides a few options to deal with errors. You can
access these options via the Excel Options button and
the Formulas category
54. Error Values in Excel
Error Value Explanation
#DIV/0! This error value is caused by trying to perform a division by zero.
#NAME? This error value is generated when a formula contains an undefined
variable or function name. Often this error value results from a
misspelled function name.
#N/A This error value is generated by a special group of functions when no
proper answer is available.
#NULL! This error value implies that the result of the calculation has no
value.
#NUM! Excel generates this error value if it finds that one or more values
supplied to perform a calculation are not of proper type. For
example, Excel might be expecting a numerical value but it is
supplied with a non-numerical value.
#REF! This error occurs when a formula uses an invalid cell reference. For
example, this error will occur if you delete a cell referred to in the
formula.
#VALUE! Excel generates this error value whenever an incorrect argument or
operator is specified in a formula.
##### This error message is displayed when a column is not sufficiently
wide or a negative date or time value is present.
55. Locating Error Sources
• Excel provides a group of commands in
the Formula Auditing panel to help you
locate error source in worksheets with
many complex calculations