+ Reply to Thread
Results 1 to 5 of 5

How to get zero to be the minimum value in a formula?

  1. #1
    Registered User
    Join Date
    04-22-2007
    Posts
    9

    How to get zero to be the minimum value in a formula?

    =IF(I25>0,H26,IF(I25=0,H26,IF(I25<0,H26-1)))

    In this formula, the value returned is -1, how can I change the formula so that any negative number will return a value of zero?

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    =if(if(i25>0,h26,if(i25=0,h26,if(i25<0,h26-1)))<0,0,if(i25>0,h26,if(i25=0,h26,if(i25<0,h26-1))))
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    04-22-2007
    Posts
    9
    Quote Originally Posted by sweep
    =if(if(i25>0,h26,if(i25=0,h26,if(i25<0,h26-1)))<0,0,if(i25>0,h26,if(i25=0,h26,if(i25<0,h26-1))))
    IT WORKED!!!!! Thank you very much.

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    A more compact option would be:

    =MAX(0,IF(I25>0,H26,IF(I25=0,H26,IF(I25<0,H26-1))))

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,698
    or

    =MAX(0,H26-(I25<0))

+ 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