+ Reply to Thread
Results 1 to 4 of 4

Finding the cell with the minimum value in a row

  1. #1
    Registered User
    Join Date
    03-15-2013
    Location
    maroco
    MS-Off Ver
    Excel 2007
    Posts
    2

    Finding the cell with the minimum value in a row

    Hi
    I need to find the cell with minimum value in a row. I found a function for that on the Internet and it does work for a range like A1:B5 but it does not work for a single row. Here it is:
    Please Login or Register  to view this content.
    My code looks like this:

    Please Login or Register  to view this content.
    The line "Debug.Print MinAddress(rw)" causes a type mismatch error here "If cell = MinNum Then" in the MinAddress function. It doesn't happen when I put the whole range(rng variable) as the parameter. How to make it work for a row?

    Example data in a row(some of the cells are empty):
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Finding the cell with the minimum value in a row

    The function you provided works just fine for me. It returns the address instead of the value. You can edit to return the value (see below) but there is already a built in function *Min()* for that.

    Please Login or Register  to view this content.
    If you don't want to use a funtion but instead want to have it print out somewhere or tell you the value in a message box just let me know in detail how you want to select your range, what you want reported, and how you want it to be reported.
    Last edited by stnkynts; 03-15-2013 at 07:09 PM.

  3. #3
    Registered User
    Join Date
    03-15-2013
    Location
    maroco
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Finding the cell with the minimum value in a row

    Unfortunately your edited function still does not work. It still shows a type mismatch error in "If cell = MinNum Then" line. Here is how the macro looks at the moment:
    Please Login or Register  to view this content.
    The macro should print the minimum value of each row in the selected range.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Finding the cell with the minimum value in a row

    Once again, it works just fine for me. I wish you the best of luck finding a solution to your problem.

+ 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