+ Reply to Thread
Results 1 to 13 of 13

Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE HELP

  1. #1
    Registered User
    Join Date
    12-09-2018
    Location
    illinois
    MS-Off Ver
    2016
    Posts
    6

    Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE HELP

    Hello, I am stuck on creating code to find the max in a set of data and outputting the name of the cell. For Example if I have the following data set:
    VIVIX 0.142966875
    HLIEX 0.104074291
    USNQX 0.144564163
    HNASX 0.072884645
    SCVIX 0.068055342
    MMYLX 0.056515137
    JDSCX 0.080380966
    WAMCX 0.03907045

    The funtion needs evaluate the entire data set and output the name next to the max so in this case USNQX

    Thank you for your help.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,010

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    .
    Paste this formula in C1

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-09-2018
    Location
    illinois
    MS-Off Ver
    2016
    Posts
    6

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Hello I need a macro vba function. I can't use the index

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Hello bmuel13,

    Welcome to the forum!

    This function will return the name of the highest value in column "B" from column "A". Row 1 is assumed to have headers.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    12-09-2018
    Location
    illinois
    MS-Off Ver
    2016
    Posts
    6

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Hey Leith thanks! I'm unfortunatley recieving an error when attmepting to run this function.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Hello bmuel13,

    How are using the function? Can you give me an example?

  7. #7
    Registered User
    Join Date
    12-09-2018
    Location
    illinois
    MS-Off Ver
    2016
    Posts
    6

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    I am new to VBA but I have copy and pasted the function exactly as you have written and write it like this on the sheet. =highestvalue(I15:I23,H15:H23) with the first row in each being the header. Thank you. H being the names and i being the values.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Hello bmuel13,

    Okay, I did not create the function to take range arguments. Give me a minute to make the changes.

  9. #9
    Registered User
    Join Date
    12-09-2018
    Location
    illinois
    MS-Off Ver
    2016
    Posts
    6

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    thank you !

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Hello bmuel13,

    This should work. The range with the names comes first and the range of values.

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-09-2018
    Location
    illinois
    MS-Off Ver
    2016
    Posts
    6

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    you're an absolute life saver, thank you it works!

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Hello bmuel13,

    Glad it is working. You're welcome.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Function for Finding Max in an a range and outputting name o adjacent cell VBA PLEASE

    Quote Originally Posted by bmuel13 View Post
    Hello I need a macro vba function. I can't use the index
    Why not?
    =IndexMatch(I15:I23,H15:H23)
    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)

Similar Threads

  1. [SOLVED] Finding a value in a list, then outputting the cell to the right
    By Yoshi64 in forum Excel General
    Replies: 6
    Last Post: 01-07-2014, 05:46 AM
  2. [SOLVED] Finding value in an adjacent cell using the FIND function
    By highlystrung in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 04:29 PM
  3. Replies: 0
    Last Post: 09-10-2012, 09:34 PM
  4. Outputting a Range of numbers to a print function
    By PatsFan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2012, 06:28 AM
  5. Finding data in adjacent range
    By thelucasgray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-29-2010, 07:35 PM
  6. Finding R-squared Values automatically and outputting range
    By student_101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2009, 05:53 PM
  7. Finding Adjacent empty cell
    By s1ip in forum Excel General
    Replies: 1
    Last Post: 07-14-2006, 03:55 PM
  8. Finding min/max of adjacent data in a range of cells
    By Paul987 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-15-2005, 03:02 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