+ Reply to Thread
Results 1 to 4 of 4

Conditional Maximum of a row of cells.

  1. #1
    Registered User
    Join Date
    11-17-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Conditional Maximum of a row of cells.

    Hello everyone.
    This looks like a simple problem, but I have to admit that I'm stumped.. This is my scenario:

    A B C D E F G
    15 25 38 42 -> 42
    0 0 0 0 -> 0
    -3 -5 -1 0 -> -1

    The 'G' column should represent the maximum value of the cells in the same row (e.g., G1 = max(A1:D1)), with the following caveats:
    - If all values are > 0, print the maximum;
    - If all values are = 0, print 0.
    - If all values are either 0 or negative, print the maximum of the negatives.

    Can somebody point me to the right direction? Thanks in advance!

  2. #2
    Registered User
    Join Date
    11-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Conditional Maximum of a row of cells.

    Quick question - when you say maximum of the negatives, you mean closest to 0, right? Or do you mean the lowest value?

  3. #3
    Registered User
    Join Date
    11-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Conditional Maximum of a row of cells.

    Here is a formula to do what you want (assuming you are not looking for the lowest negative number - aka the one with the highest absolute value):

    =IF(MIN(A1:D1)>0,MAX(A1:D1),IF(AND(MIN(A1:D1)=0,MAX(A1:D1)=0),0,IF(MAX(A1:D1)<=0,MAX(A1:D1))))

    I attached an example sheet as well...
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Conditional Maximum of a row of cells.

    Hi
    Try this

    Please Login or Register  to view this content.
    Regards
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

+ 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