copy cells left and right of max

tomrus

New Member
Joined
Jul 5, 2008
Messages
5
I have a row of numbers: 1, 5, 8, 2, 4, 6, I want to find the max say =max(A1:A6) (which is 8) and copy the values of the cell adjacent of the max (5 and 2), I tried to play with match and hlookup but I wasn't able to make it work. The results should be in new cells like: 5, 8, 2. Any hints much appreciated!

TOM:confused:
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try:

=INDEX(A1:A6,MATCH(MAX(A1:A6),A1:A6,FALSE)-1)
=INDEX(A1:A6,MATCH(MAX(A1:A6),A1:A6,FALSE))
=INDEX(A1:A6,MATCH(MAX(A1:A6),A1:A6,FALSE)+1)
 
Upvote 0
if this as trivial in "real" life as your example suggest I'd suggest the following assuming you wanted 5 in B1, 8 in B2 and 2 in B3

do B2 first (just max)

=MAX($A$1:$A$6)

then do the others, preceeding value

=OFFSET($A$1,MATCH($B$2,$A$1:$A$6,0)-2,0)

latter value

=OFFSET($A$1,MATCH($B$2,$A$1:$A$6,0),0)

If it's more complex than this you could use a CHOOSE based on row position with a dynamic offset based on Match of MAX.
 
Upvote 0
guys, you are something! you solved the problem in 5 minutes, your input was so much appreciated!:)

Tom
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top