+ Reply to Thread
Results 1 to 4 of 4

Locate cell position for max value in column

Hybrid View

  1. #1
    Registered User
    Join Date
    12-07-2007
    Posts
    1

    Locate cell position for max value in column

    I'm sure there is some fairly simple way to search for the maximum value in a column of numbers and return the cell position of that maximum value, but I haven't been able to figure this out. Help, please!!??

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Locate cell position for max value in column

    Not quite sure about how you want to apply it....

    so...
    Maybe something like:

    This formula returns the Row Number of the cell containing the first instance of the max column value:

    =MATCH(MAX(A:A),A:A,0)

    Does that help?
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179
    Quote Originally Posted by maladroit1
    I'm sure there is some fairly simple way to search for the maximum value in a column of numbers and return the cell position of that maximum value, but I haven't been able to figure this out. Help, please!!??
    Lets assume the following sample in A2:A10...

    6
    8
    7
    9
    8
    10
    3
    10
    9

    In D2 enter:

    =MAX(A2:A10)

    In D3 enter:

    =COUNTIF(A2:A10,D2)

    In D4 enter: Result

    In D5 enter:

    =IF(ROWS($D$5:D5)<=$D$3,SMALL(IF($A$2:$A$10=$D$2,ROW($A$2:$A$10)-ROW($A$2)+1),ROWS($D$5:D5)),"")

    which must be confirmed with control+shift+enter then copied down.

    This formula yields the relative positions of the instances of the max value.

    The following...

    =IF(ROWS($D$5:D5)<=$D$3,SMALL(IF($A$2:$A$10=$D$2,ROW($A$2:$A$10)),ROWS($D$5:D5)),"")

    yields the native row positions of the instances of the max value.

    And...

    =IF(ROWS($D$5:D5)<=$D$3,CELL("address",INDEX($A$2:$A$10,SMALL(IF($A$2:$A$10=$D$2,ROW($A$2:$A$10)-ROW($A$2)+1),ROWS($D$5:D5)))),"")

    lists the actual cells they occupy.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Locate cell position for max value in column

    I like your idea to list each relative position of the max value.

    I'd prefer to avoid the array formulas, though, and go with something like this:

    Using your sample structure:
    D2: =MAX(A2:A51)
    D3: =COUNTIF(A2:A51,D2)
    
    D4: Result
    D5: =IF(ROWS($5:5)<=$D$3,MATCH($D$2,$A$2:$A$51,0),"")
    
    D6: =IF(ROWS($5:6)<=$D$3,MATCH($D$2,INDEX($A$2:$A$51,D5+1):$A$51,0)+D5,"")
    
    Copy D6 down as far as needed.
    
    Note: Those formulas return the RELATIVE POSTITION of the 
    max value(s) in the referenced range.  If the actual row number is required:
    D5: =IF(ROWS($5:5)<=$D$3,MATCH($D$2,$A$2:$A$51,0)+ROW($A$1),"")
    
    EDITED TO CORRECT THE BELOW FORMULA
    D6: =IF(ROWS($5:6)<=$D$3,MATCH($D$2,INDEX($A:$A,D5+1):$A$51,0)+D5,"")
    Last edited by Ron Coderre; 12-08-2007 at 07:09 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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