Why does this confuse me?? -- ? on Offset function

A

Awrex

I'm trying to understand how/why this works...

=OFFSET(A12,MATCH(MAX(E12:E300),E12:E300,0)-1,)

So the reference cell is a12 - got that
Understand the MATCH/MAX functions.
I'm confused about the -1 aspect of the OFFSET function.
If I understand this it's referencing one row below the reference A12...
however it's referencing the same row.... the formula works, though I'm
confused as to why...
 
T

T. Valko

MATCH returns a number from 1 to n (or, possibly an error).

So, if you want to include the value of cell A12 in the calculation then you
have to correct the MATCH offset from 1 to n to 0 to n. To do that you
subtract 1 from the result of MATCH.

Let's assume E12 is the max value of the range. So:

MATCH(MAX(E12:E300),E12:E300,0) = 1

If you didn't use the -1 correction then you'd have:

=OFFSET(A12,1,) = A13

With the -1 correction you have:

=OFFSET(A12,0,) = A12

Another way to do this is with the INDEX function:

=INDEX(A12:A300,MATCH(MAX(E12:E300),E12:E300,0))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top