简体   繁体   中英

How can I use excel to find the offset of the max value in a range?

I am working in excel and want the value of one cell to equal the offset of -1 columns to whatever value in a range is the largest.

Here is what I have so far.

=CELL("address",INDEX(D9:D11,MATCH(MAX(D9:D11),D9:D11,0)))

I thought it might be possible to set the value using VBA on change but, was not sure how to do that one either.

Thanks in advance!

Close but I think is simpler:

=INDEX(C:C,MATCH(MAX(D:D),D:D,0))

Will only find the first instance (lowest row number) where the maximum is repeated.

The above is 'generalised' but for a specific range (say to avoid where a maximum value occurs more than once), something like:

=INDEX(C9:C11,MATCH(MAX(D9:D11),D9:D11,0))

MATCH returns the position (if found, of the first instance) counting from the start of the range (so 1 if in D9 in the second example above). INDEX also counts from the start of its range.

You can use Index formula mentioned above but you may want to generalize the formula to use all rows in column C and D (using C:C instead of C9:C11).

Another option is the "offset" formula below. Assuming the range you are "scanning" for the largest value is in column D, the formula would be: =OFFSET(D1,MATCH(MAX(D:D),D:D)-1,-1)

Consider using an ID or a number for all values youre working on. then, use other ID#2 which a sum of ID & the value. Then you implement maxif to ID#2. After that you use VLOOKUP to whatever data you want. no need to use OFFSET.

enter image description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM