Spreadsheets Relative & Absolute Addresses CIL 102 ‘08 Fall Relative & Absolute Addresses • The concept of relative and absolute addresses becomes relevant when a spreadsheet user builds spreadsheets and copies formulas • Copying formulas is frequently performed as a part of fundamental process Simple Relative Address Example Compute perimeter and area of rectangles • Formulas – P = 2*(L+W) – A = L*W • Use labels to set up your table Simple Relative Address Example Compute perimeter and area of rectangles • Place perimeter formula in the first row • Place area formula in the first row Simple Relative Address Example Compute perimeter and area of rectangles • Highlight the two formulas and select Copy • Copy them to the remaining slots in the two columns by highlighting the area and select Paste Simple Relative Address Example Compute perimeter and area of rectangles • As you move the cursor from formula to formula, not how the references to the length and width are adjusted, relative to the formula. • The formulas in row 4 reference the length and width in row 4, the formulas in rows 5, reference the values in row 5, and so forth. Simple Relative Address Example • As long as the addresses associated to a formula change as the formula location changes, then relative addressing is fine • RULE OF THUMB Normally, formula references within a table are relative addressed as long as data and formulas are in rows or columns. • Use a color highlight for each table to guide you. Simple Absolute Address Example • To illustrate absolute addressing, consider this variation of the perimeter/area table where the length is fixed. • Perimeter and area change with length. Simple Absolute Address Example • Note that the length is outside of the table, it stays fixed. • The width varies from row to row. Simple Absolute Address Example The F4 Key. • When you point to the length, press the F4 key. Note the $ symbols – this indicates an absolute address • The width is a relative address Simple Absolute Address Example The F4 Key. • When the formula is duplicated down the column, the length reference says fixed (absolute), the width reference is relative Simple Absolute Address Example The F4 Key. • Complete the area computation in the same manner Simple Absolute Address Example The F4 Key. • Complete the Area computation with one absolute and one relative address. • Copy the formula • Note the absolute and relative references. GPA Calculator GPA Calculator • List your courses • List your grades • List the number of credits GPA Calculator • • • • • Lookup the grade in the table and record the points Compute the total points Sum the points Sum the credits Compute the GPA Look up the grade • Vertical look up table • The look up table is outside of the GPA table, hence ABS address. • The grade being looked up is in the GPA table, hence REL address Vlookup • Lookup_value: The grade (relative address) • Table_Array: The table (Absolute address) • Col_index_num: Number in column 2 Vlookup • Col_index_num: Number in column 2 • Table_Array: The table (Absolute address) • Lookup_value: The grade (relative address) VLookup Multiply points * credits Copy formulas down columns Auto Sum • Credit column • Total points column GPA • Divide total points by total credits