+ Reply to Thread
Results 1 to 11 of 11

Need Some Help Guys..Want to find max value and some values above and below it

  1. #1
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Need Some Help Guys..Want to find max value and some values above and below it

    Column1
    1
    2
    3
    4
    5
    6
    7
    6
    5
    4
    3
    2
    1
    For example I have these value...I want to know how can I extract maximum value and certain values above and below that maximum Value

    For example

    Max=7

    above max values=6,5,4

    Below max Values=6,5,4

    Thanks

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    How can 6, 5, 4 be above the maximum if the max value is 7 ? Do you mean the three values in the cells BEFORE and AFTER where the maximum occurs?

    Pete

  3. #3
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    yes exactly....certain number of values below and after the max occured...
    Last edited by Haidar123; 03-21-2014 at 08:08 AM.

  4. #4
    Forum Contributor
    Join Date
    03-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016 (among others!)
    Posts
    331

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    Rather than a custom function wouldn't you be better using MATCH, INDEX and working from there to get what you are looking for? That will only work if there's only 1 instance of the max value of course. I'd presume that would be the same for a custom function too though.

  5. #5
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    Hi
    For above
    =IFERROR(LARGE(OFFSET($A$1,0,0,MATCH(MAX($A:$A),$A:$A,0)-1,1),COLUMN()-5),"")

    For below
    =IFERROR(LARGE(OFFSET($A$1,MATCH(MAX($A:$A),$A:$A,0),0,COUNT($A:$A)-MATCH(MAX($A:$A),$A:$A,0),1),COLUMN()-5),"")

    COLUMN()-5 inside the formula you may change depending on your data
    Appreciate the help? CLICK *

  6. #6
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    thank u so much....Can these values in order exactly the same in column?

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    do you want then sorted or just as they are?
    if its not relevent to wether they are sorted
    then just =INDEX($A$1:$A$20,MATCH(MAX($A$1:$A$20),$A$1:$A$20,0)-1) then -2 then -3 and +1+2+3
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  8. #8
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    Martin thank u so much it works fine Thanks to all

  9. #9
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    Column() - 5 means
    I started formula from F column and value of it is 6. Column() formula gives me 6. In order to get 1st (2nd and etc. as I drag right) larger value I write =Column()-5. For example if your formula will start from D column then you should modify it to Column()-3 to get value of one.
    Also if you want to get value from up to down you can use Row() function too.

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    @AZ-XL:

    I got the impression that the data represented some time-variant data, and that the OP was interested in values on either side of the peak (as with Martin's suggestion - he beat me to it!), so I'm not sure if the OP needed the data sorted as your solution does.

    Pete

  11. #11
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Need Some Help Guys..Want to find max value and some values above and below it

    You are right Pete. Seeing 6-5-4 directly I thought that OP wants sort from larger to smaller.
    Thank you for your attention.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hai guys...
    By avecf in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 02-03-2014, 01:03 AM
  2. Hi, Guys!
    By Thu Rein in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-26-2013, 06:27 AM
  3. Replies: 1
    Last Post: 04-19-2013, 08:30 PM
  4. Hello Guys
    By Nikkishr in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 11-01-2012, 07:43 AM
  5. [SOLVED] Using range.find to find two specific values in two columns
    By mhrub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2012, 01:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1