How to create a dynamic defined range in an Excel worksheet (830287)
The information in this article applies to:
- Microsoft Office Excel 2003
- Microsoft Excel 2002
- Microsoft Excel 2000
- Microsoft Excel 97 for Windows
- Microsoft Excel 2004 for Mac
- Microsoft Excel X for Mac
- Microsoft Excel 2001 for Mac
SUMMARYIn Microsoft Excel, you may have a named range that must be
extended to include new information. This article describes a method to create
a dynamic defined name. Note The method in this article assumes that there are no more than
200 rows of data. You can revise the defined names so that they use the
appropriate number and reflect the maximum number of rows. back to the topUse the OFFSET Formula with a Defined Name To use this method, follow these steps:
- In a new worksheet, type the following data:
| A | B | 1 | Month | Sales | 2 | Jan | 10 | 3 | Feb | 20 | 4 | Mar | 30 |
- On the Insert menu, point to
Name, and then click Define.
- In the Names in workbook box, type
Date.
- In the Refers to box, type:
=OFFSET($A$2,0,0,COUNTA($A$2:$A$200),1).
- Click Add.
- In the Names in workbook box, type
Sales.
- In the Refers to box, type:
=OFFSET($B$2,0,0,COUNT($B$2:$B$200),1).
- Click OK.
- Clear cell B2, and then type the following formula:
=RAND()*0+10.
Note In this formula, COUNT is used for a
column of numbers, while COUNTA is used for a column of
text values.
This formula uses the volatile RAND function. This
formula automatically updates the OFFSET formula that is used in the defined
name "Sales" when you enter new data in column B. The value 10 is used in this
formula because it is the original value of cell B2. back to the
top
Modification Type: | Minor | Last Reviewed: | 1/11/2006 |
---|
Keywords: | kbHOWTOmaster KB830287 kbAudEndUser |
---|
|