The information in this article applies to:
SUMMARYThis article discusses how you can determine the beginning and end used rows of a range by using the IF, ISBLANK, MAX, MIN, and ROW functions. The results can provide information to other functions and can help you to determine variable ranges. This article provides formulas for finding the first and last rows, plus an example of how you can select a variable range using these formulas. The following example assumes that there is at least one used cell. Complications caused by empty ranges are beyond the scope of this article. MORE INFORMATIONFirst RowThe formula to return the row number of the first used cell in a range is as follows:
As an alternative, to return the row of the first number, the formula is as follows:
Last RowThe formula to return the row number of the last used cell in a range is as follows:
As an alternative, to return the row of the last number, the formula is as follows:
How to Use the Results of These FormulasBecause the answers returned by the formulas are the rows meeting the IF condition statements, you can select the range from the top numerical cell to the bottom numerical cell, excluding cells above and below that used range. Note that unused cells can be inside the range and will not be excluded by the example. The example looks for a number, therefore you need to use the alternate formulas (that is, the formulas to find the row of the first number and the row of the last number).To determine the range, type all of the following into a single cell outside the range A2:A400:
NOTE: There are no spaces in the above formula; multiple lines are used only to fit the formula into this document. Do not include any spaces as you type it into the cell. All of the above are array formulas and may require the Array entry. If you are using Microsoft Windows, press CTRL+SHIFT+ENTER. If you are using a Macintosh computer, press COMMAND+RETURN. If you use an array range in excess of 2,730 cells, you may receive an error because array management is limited to one segment of memory (64K). Some versions of Microsoft Excel may be able to use larger arrays, depending on the internal length the code uses for number storage. (Programs using 16-bit code can use larger arrays than programs using 32- bit code.) This is by design in Microsoft Excel. For additional information about this behavior in Microsoft Excel, please see the following article in the Microsoft Knowledge Base: Q137921 : Error If Array Contains More Than 2730 Elements REFERENCES
For more information about Arrays in Microsoft Excel 7.0, click Answer
Wizard on the Help menu, and type:
Additional query words: 8.00 97 XL97 98 XL98
Keywords : xlformula |
Last Reviewed: May 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |