Thread: OFFSET problem
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default OFFSET problem

alan82 wrote...
I have a problem when using the offset function. I am using the Match
function to find the first and last occurences of a string in a series
of data. When the string is early in the data this works. When the
string is late in the data -- past 1000 rows -- the offset function
returns nothing.

Does anybody know why this is??

....
=COUNT(OFFSET(MGCSales,MATCH($F$5,Source!$A$3:$A$ 33412,0),8,
MATCH($F$5,Source!$A$3:$A$33412,1)-MATCH($F$5,Source!$A$3:$A$33412,0),1))


Is Source!$A$3:$A$33412 sorted in ascending order? If not, MATCH($F
$5,Source!$A$3:$A$33412,1) is unreliable. That's the most likely
reason your formula fails.

Also, your 2nd argument to your OFFSET call gives the row index
(starting from 1) in Source!$A$3:$A$33412 of the first instance of the
value of F5. Unless MGCSales has a header row as its top row that you
want to skip, you should be subtracting 1 from the first MATCH call's
result.

You could avoid the volatile OFFSET call and make the formula clearer
using two INDEX calls. Defining the name LIST referring to Source!$A
$3:$A$33412,

=COUNT(INDEX(MGCSales,MATCH($F$5,LIST,0),9):INDEX( MGCSales,MATCH(2,1/
(LIST=$F$5)),9))