+ Reply to Thread
Results 1 to 4 of 4

count result as zero unless positive value

  1. #1
    Registered User
    Join Date
    12-29-2005
    Posts
    90

    count result as zero unless positive value

    is there a way to get a formula to count a zero if it would normally return a negative value?

    example

    result = 100
    target =300
    result = -200

    but i want it to show as zero

    does this make sense?

    i'll bet its really simple but i'm stuck

    any help appreciated
    Last edited by jimb0693; 07-07-2009 at 05:36 AM.

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

    Re: count result as zero unless positive value

    Hello jimb0693,

    A function can not be changed to return zero for a number less than zero unless it has been programmed that way. You can use an IF statement to test the results and return a zero for result s that are negative.
    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!)

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: count result as zero unless positive value

    Another alternative would be to use MAX:

    =MAX(0,result-target)

    so the output is the greater of 0 and the calculation result.

    I have read that MAX executes about 40% faster than an IF

  4. #4
    Registered User
    Join Date
    12-29-2005
    Posts
    90

    Re: count result as zero unless positive value

    max worked perfectly, thank you donkeyote. and thanks for your help also leith ross

+ 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