+ Reply to Thread
Results 1 to 7 of 7

Find index where max value occurs

  1. #1
    Registered User
    Join Date
    07-11-2008
    Location
    THE NORTH
    Posts
    52

    Find index where max value occurs

    Hi,

    I am working on UDF.

    I want to find the maximum value in column Y. But I also want the index at which the maximum value is found such that I can also find the corresponding X value.

    You see X represents time and Y represents signal. So I want to find the x value at which the Y signal is maximum. But I also would like to know the index within the column at which these values occur.

    Can anyone please offer help/advice?

    My code is below.

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    01-01-2005
    MS-Off Ver
    2007
    Posts
    368

    Re: Find index where max value occurs

    Hi,

    Can you post a workbook with an example?

    Elio Fernandes
    Last edited by efernandes67; 09-05-2011 at 07:26 AM.

  3. #3
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Find index where max value occurs

    you don't need a UDF you can use a Match and Index.

    For Example:
    =INDEX(A1:A8,MATCH(MAX(B1:B8),B1:B8,0))

  4. #4
    Registered User
    Join Date
    07-11-2008
    Location
    THE NORTH
    Posts
    52

    Re: Find index where max value occurs

    Hi Thanks for your replies.

    I realize that you can do this specific thing without VBA but I need to get this data to proceed with my UDF.

    Example data would be:

    X Y
    1.1 1000
    1.2 2300
    1.3 1100
    1.4 507
    1.5 2000
    ... ...

    e.g.) Max in Y is 2300. This is when X = 1.2
    This is the 2nd element of the column of input data.

    How do I do this in VBA?

    Cheers

  5. #5
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Find index where max value occurs

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Find index where max value occurs

    if you want only the index without the values just eliminate the index function:
    Please Login or Register  to view this content.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Find index where max value occurs

    To find the value in column 7, corresponding to teh row of the maximin in column6:

    Please Login or Register  to view this content.



+ 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