ID: Q101167
4.00 4.00a | 4.00
WINDOWS    | MACINTOSH
The information in this article applies to:
In Microsoft Excel 4.0, to find the nth value in a range of cells that meets a condition, use the SMALL() or LARGE() function to evaluate the array of row numbers that meet the condition.
To find the nth nonblank value in a range, enter the following formula as an array:
   =INDEX(range,SMALL(IF(ISBLANK(range),"",ROW(range)),n)-ROW(range)+1)
In above example, the range argument refers to the cells you are searching and the n argument is a number indicating the occurrence you are looking for. For example, if range refers to cells A1:A10 and n is 2, the formula returns the second nonblank value from cells A1:A10.
Following is a description of how the formula works:
In the following section of the formula,
   SMALL(IF(ISBLANK(range),"",ROW(range)),n)
In the -ROW(range)+1 section of the formula, the starting row number in the range is subtracted from the row number returned by SMALL() and then 1 is added. This calculates a relative "position" of the value in the range so that the value can be returned with the INDEX() function.
If the nth value is a blank, and the remaining cells in the range are blank, the #NUM! error value will be returned to the cell. If you want to find the nth value from the bottom up (instead of from the top down), use the LARGE() function instead of the SMALL() function.
"Function Reference", version 4.0, pages 236-238, 250-251, 406
KBCategory: kbusage KBSubcategory:
Additional reference words: 4.00 4.00a howto returning
Keywords          :  
Version           : MACINTOSH:4.0; WINDOWS:4.0,4.0a,97
Platform          : MACINTOSH WINDOWSLast Reviewed: March 24, 1999