computer science 1000 spreadsheets iii permission to redistribute these slides is strictly...

26
Computer Science 1000 Spreadsheets III Permission to redistribute these slides is strictly prohibited without permission

Upload: derick-matthews

Post on 04-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Computer Science 1000

Spreadsheets III

Permission to redistribute these slides is strictly prohibited without permission

Referencesup until now, all values in cells depended

only on the information in their formulas in other words, cell B6 was only affected by the

data/formula entered into B6 this results in a few inefficiencies:

data has to be repeatedupdating information in one cell requires

manually updating all related cells

Consider our previous example:

Note that all prices had to be repeated in this cell. Furthermore, if the price of socks changes, we have to update 4 different cells.

Referencesa formula that refers to the information in

another cell/rangewhen the name of a cell or range is used as a

formula (or in a formula), that name is replaced with its stored values

as a result:data doesn’t have to be copiedcells automatically update themselves when

referred cell values change

Simple Cell Reference the simplest formula for a cell reference is the label of a cell

remember: a cell label consists of its column, then row

Cell Reference this simple notion of cell references is very powerful consider our previously mentioned inefficiencies

Note that to use the value 3 from the previous cell, we did not have to repeat that value in B1.

Cell Reference this simple notion of cell references is very powerful consider our previously mentioned inefficiencies

Note that anytime we change A1, all cells that reference A1 automatically update.

Cell Reference – Automatic Updatingnote that the automatic updating feature

cascadeswhen B1 automatically updates, any cells

referencing B1 will update as well

References as with numbers and text, cell references are

typically not used as a standalone formula rather, they are used as part of another formula recall the max function shown earlier

Back to Previous Exampleupdate example to make use of references

Back to Previous Exampleupdate example to make use of references

Back to Previous Exampleupdate to make use of references

Cell References previous example shows how powerful references

can be however, there is still a matter of user efficiency

What would happen if there were 150 items purchased in the transaction?

Range References recall that a range is a reference to multiple cells many Excel functions allow a user to pass a range

in place of multiple parameters e.g. the max function:

Cell References there is a function called sum, that works like max, but returns

the sum of its input values, rather than the largest one use sum to compute Subtotal

Cell References let’s extend our receipt example to allow a quantity to be

attached to each item we’ll rename Price to Cost

Cell References first, we’ll insert a couple of columns (Quantity, Price)

the formulae should stay under the Price heading

Cell References the quantity column will be updated by the user, depending on

how many items they buy

Cell References the Price column will be calculated from the Quantity and

Cost

Cell References this formula should be repeated for each item

Copy and Fill the previous example works, but we see a

similar user efficiency issue as before

What would happen if there were 150 lines of items purchased in the transaction?

Copy and Fill fortunately, Excel (and others) allow two convenient

methods to easily repeat a formula in multiple cells Copy

Select the cell that you want to copy the formula from Indicate Copy (e.g. Ctrl+C)

cell will indicate that it’s about to be copied via an animated highlight

Select the cell(s) that you want to paste to can be a single cell, or a range

Indicate Paste (e.g. Ctrl+V)

Ctrl+C

Select New Range

Ctrl+V

Copy and Fill

Notice that the Excel modified each formula appropriately, to match the cell. This is due to relative references (explained later).

Copy and Fill Fill

similar to copy, but doesn’t require clipboard

Method: Select the cell that you want to copy the formula from Grab the Fill Handle on bottom right corner Drag around cells that you wish to copy into

Handle

Drag

Release