Presentation on theme: "More on Cell and Range References. n A reference identifies a cell or a range of cells on a worksheet and tells Microsoft Excel where to look for the."— Presentation transcript:
More on Cell and Range References
n A reference identifies a cell or a range of cells on a worksheet and tells Microsoft Excel where to look for the values or data you want to use in a formula. n With references, you can use data contained in different parts of a worksheet in one formula or use the value from one cell in several formulas.
n You can also refer to cells on other sheets in the same workbook, to other workbooks, and to data in other programs.
n References to cells in other workbooks are called external references. n References to data in other programs are called remote references.
n By default, Microsoft Excel uses the A1 reference style, which labels columns with letters (A through IV, for a total of 256 columns) and labels rows with numbers (1 through 65536).
n To refer to a range of cells, enter the reference for the cell in the upper-left corner of the range, a colon (:), and then the reference to the cell in the lower-right corner of the range. n The following are examples of references.
n To refer to n The cell in column A and row 10 n The range of cells in column A and rows 10 through 20 n The range of cells in row 15 and columns B through E n Use n A10 n A10:A20 n B15:E15
n All cells in row 5 n All cells in rows 5 through 10 n All cells in column H n All cells in columns H through J n 5:5 n 5:10 n H:H n H:J
n You can also use a reference style where both the rows and the columns on the worksheet are numbered--R1C1 style. n In R1C1 style, Microsoft Excel indicates the location of a cell with an "R" followed by a row number and a "C" followed by a column number.
n R1C1 style is useful for computing row and column positions in macros and can be useful for showing relative cell references. n To switch into or out of the R1C1 reference style, use the Tools => Options… dialog box and select the General tab:
n If you switch to the R1C1 style, your worksheet will look like this:
Cell D50 now referenced as R50C4
n You can use the labels of columns and rows on a worksheet to refer to the cells within those columns and rows, n or you can create descriptive names to represent – cells, – ranges of cells, – formulas, or – constant values.
n If you want to analyze data in the same cell or range of cells on multiple worksheets within the workbook, use a 3-D reference. n A 3-D reference includes the cell or range reference, preceded by a range of worksheet names. The symbol ‘!’ is used to separate the worksheet name from the cell names. n Microsoft Excel uses any worksheets stored between the starting and ending names of the reference.
n For example, Sheet1:Sheet3!B5:D10 is a 3-D reference to all the cells in Sheet1, Sheet2, and Sheet3 that lie between cells B5 and D10 on these worksheets. There are 54 such cells in this 3-D range. (We assume that the workbook contains Sheet1, Sheet2, and Sheet3, in that order.)
Labels and names in formulas n Worksheets usually have labels at the top of each column and to the left of each row that describe the data within the worksheet. n You can use these labels within formulas when you want to refer to the related data. n You can also create descriptive names that are not labels on the worksheet to represent cells, ranges of cells, formulas, or constants.
n When you create a formula that refers to data in a worksheet, you can use the column and row labels in the worksheet to refer to the data. n For example, if a table contains sales amounts in a column labeled Sales and a row for a division labeled Support, you can find the sales amount for the Support division by entering the formula =Support Sales.
n The space between the labels is the intersection operator, which designates that the formula should return the value in the cell at the intersection of the row labeled Support and the column labeled Sales.
The formula The Result (unformatted)
Multiple labels in formulas n When you have labels for the columns and rows on your worksheet, you can use those labels to create formulas that refer to data on the worksheet. n If your worksheet contains stacked column labels in which a label in one cell is followed by one or more labels below it, you can use the stacked labels in formulas to refer to data on the worksheet.
n For example, if the label Projected is in cell E5 and the label 1996 is in cell E6, the formula =SUM(Projected 1996) returns the total value for the Projected 1996 column. n If row 8 contains sales amounts and the label Sales is in cell D8, you can refer to the projected sales amount for 1996 with the formula =Projected 1996 Sales.
n When you refer to information by using stacked labels, you refer to the information in the order in which the labels appear, from top to bottom.
n If the label 1996 is in cell E5 and the label Actual is in cell E6, you can refer to the actual figures for 1996 by using 1996 Actual in a formula. n For example, to calculate the average of the actual figures for 1996, use the formula =AVERAGE(1996 Actual).
n If your data does not have labels or if you have information stored on one worksheet that you want to use on other sheets within the same workbook, you can create a name that describes the cell or range. n A descriptive name in a formula can make it easier to understand the purpose of the formula.
Naming cells in a workbook n In Microsoft Excel, you can name a single cell or a range of cells to make formulas easier to read and remember. n If you have row and column labels on a worksheet, you can refer to them directly in a formula, or you can use them as names that represent the associated cells.
To name a cell or a range of cells n 1 Select the cell, range of cells, or nonadjacent selections that you want to name. n 2 Click the Name box at the left end of the formula bar. n 3 Type the name for the cells. n 4 Press ENTER. n Note: You cannot name a cell while you are changing the contents of the cell.
n You can also create a name that represents the same cell or range of cells on more than one worksheet.
n For example, the formula =SUM(FirstQuarterSales) might be easier to identify than =SUM(SalesC20:C30). In this example, the name FirstQuarterSales represents the range C20:C30 on the worksheet named Sales.
n Names are available to any sheet within the workbook. n For example, if the name ProjectedSales refers to the range A20:A30 on the first worksheet in the workbook, you can use the name ProjectedSales on any other sheet in the same workbook to refer to range A20:A30 on the first worksheet.
n Names can also be used to represent formulas or values that do not change (constants). For example, you can use the name SalesTax to represent the sales tax amount (such as 6.2 percent) applied to sales transactions. n Note that, by default, names use absolute cell references.