+ Reply to Thread
Results 1 to 21 of 21

Finding the second highest value in the list

  1. #1
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Lightbulb Finding the second highest value in the list

    There is a coloumn which has 1000 sets of datas starting from a2:a1001 and at a3 i have managed to find the highest value in that range which is 80 by using the formula =MAX(IF(a2:a1001>0,a2:a1001,FALSE)).

    Now at a4 i want to find the second highest value in that range which is 75 and at a5 the third highest value in that range , which is 60 and so on by using a formula.

    Can anyone help me to find a proper answer?


    note: in the range there are repeated values.


    Thanks in advance

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Finding the second highest value in the list

    Use
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,075

    Re: Finding the second highest value in the list

    Instead of your formula use this in A3 =LARGE(H6:H140,1) to return the highest number in the range. By changing it to =LARGE(H6:H140,2) in A4 it will return the second highest number and so on.
    Trish in Oz
    -------------
    A problem well defined is a puzzle half solved


    If you attach a sample of your workbook it will be easier to find a solution. Remember to remove/replace sensitive data before uploading the file. Look here if you need help with attachments:
    http://www.excelforum.com/faq.php?fa...b3_attachments

  4. #4
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179

    Re: Finding the second highest value in the list

    Do you really need to do the >0 test? Is it not just...

    C2, just enter:

    =LARGE($A$2:$A$1001,ROWS($C$2:C2))

    and copied down?

  5. #5
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Finding the second highest value in the list

    I'm guessing you mean b3 and b4 rather than a3 and a4 as this is part of your data set.

    Why not try =large(a2:a1001,2) for 2nd largest and =large(a2:a1001,3) for third largest and so on
    Happy with my advice? Click on the * reputation button below

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Finding the second highest value in the list

    Also you can use array like this...


    =SUM(LARGE(A:A,{1,2,3,4,5}))


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  7. #7
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Finding the second highest value in the list

    Hi,

    Thanks for your support.

    I have some questions just to simplify the task:
    I did typed =sum(large(a1:a20,{1})) in cell b1 to get the first highest it did worked well to get the first highest. Then i did typed =sum(large(a1:a20{2})) in b3 and it also returned the same value as in b1 which is 20. In the range there are only three values and all of them are 20. My hope was to get 0 in b3 not 20 as the second highest.

    Also i'am looking for something like this as a bonus adjustment:
    When i paste the same formula in any cells, i would like that constant number within braces to be also increased by 1.
    Lets say first paste in any cell to become =sum(large(a1:a20,{2})), second paste =sum(large(a1:a20,{3})) etc.

    If this could happen then it would be of more utility?
    Last edited by LAVA2; 12-23-2014 at 06:11 PM.

  8. #8
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Finding the second highest value in the list

    You could type the numbers 1 to 10 say in column B and use =large($a$1:$a$20,B1) and put this in C1 and copy down to C10

    Note too I ditched the SUM. You don't need it

  9. #9
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179

    Re: Finding the second highest value in the list

    @LAVA2

    =LARGE($A$1:$A$20,ROWS($B$1:B1))

    copied down to B2, and so on.

  10. #10
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Finding the second highest value in the list

    =large($a$1:$a$20,rows($b$1:b1)) also displayed 20 as first second and third consecutively.

  11. #11
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Finding the second highest value in the list

    "Typed the numbers 1 to 10 say in column B and used =large($a$1:$a$20,B1) in C1 and copy down to C10."

    Already tried that without success, as again the same problem of repetition.

  12. #12
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Finding the second highest value in the list

    If you've got data that is say 100,20,20,20,1 then you'll get 20 as the 2nd the 3rd and the 4th highest numbers.

  13. #13
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179

    Re: Finding the second highest value in the list

    Quote Originally Posted by LAVA2 View Post
    =large($a$1:$a$20,rows($b$1:b1)) also displayed 20 as first second and third consecutively.
    If you have:

    A1 = 20
    A2 = 15
    A3 = 20

    and all other values are smaller than the ones above, you' should get:

    B1 = 20
    B2 = 20
    B3 = 15

    with the suggested formula.

  14. #14
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Finding the second highest value in the list

    @Crooza your'e right in the context within a certain range, but in reality for practical reasons can same number have same level of increasing magnitude!!

  15. #15
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Finding the second highest value in the list

    Yes because its simply an array listed from highest to lowest and the large function counts the nth number in teh array. I assume you don't want multiple occurances so an array of 100,20,20,20,1 gets chnaged to 100,20,1 so highest is 100, 2nd is 20 and third is 1. If so I'll have to think about how to do that. Brighter minds than mine might work it out before I get back to you though. I'll give it some thought

    Merry Christmas

  16. #16
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Finding the second highest value in the list

    Is this what you mean?

    Row\Col
    A
    B
    C
    1
    10
    2
    20
    10
    B2: =SMALL($A$1:$A$6, COUNTIF($A$1:$A$6, "<=" & B1) + 1)
    3
    20
    20
    4
    10
    30
    5
    30
    40
    6
    40
    Entia non sunt multiplicanda sine necessitate

  17. #17
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Finding the second highest value in the list

    Thanks SHG. Would have taken me a while to get there.

    I think the OP wanted the highest to lowest so I took your formula an modified to

    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Finding the second highest value in the list

    @shg thanks for your solution, actually just would like to ask if it could be bit more flexible?

    A) Below is the model that shows how my data should be:


    O2= 20 P2= 20 T2= 0 OR Blank X2= 0 or Blank
    O3= 20
    O4= 20
    O5
    O6
    O7
    O8
    O9
    O10
    O11
    O12
    O13
    O14
    O15
    O16
    O17
    O18
    O19
    O20

    B) After entering a formula at P2, Is it possible to paste the same formula at T2 and X3 without any modifications and simply acquire Second and Third largest?

  19. #19
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding the second highest value in the list

    You would need separate formulas.

    Assuming no negative numbers.

    P2: =MAX(O2:O20)

    T2: array entered**

    =IFERROR(1/(1/MAX(IF(O2:O20<P2,O2:O20))),"")

    X3: array entered**

    =IFERROR(1/(1/MAX(IF(O2:O20<T2,O2:O20))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  20. #20
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: Finding the second highest value in the list

    @Tony Valko what an Ace, JUST MADE MY DAY
    And that brilliant formula, I must say you Know Your Onions
    Keep it up & MERRY CHRISTMAS

  21. #21
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding the second highest value in the list

    You're welcome. Thanks for the feedback!

+ 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. Finding the next highest value in a list of numbers
    By miisstina in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2014, 11:34 PM
  2. Replies: 7
    Last Post: 03-18-2014, 09:24 PM
  3. Replies: 2
    Last Post: 06-26-2012, 10:01 AM
  4. Replies: 4
    Last Post: 10-08-2010, 04:18 AM
  5. Finding the next highest value in a list
    By mc32 in forum Excel General
    Replies: 4
    Last Post: 02-07-2006, 02:45 PM

Tags for this Thread

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