+ Reply to Thread
Results 1 to 7 of 7

Showing Negative Values As 0

  1. #1
    Registered User
    Join Date
    06-16-2008
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72

    Showing Negative Values As 0

    Hi,

    What I am trying to do is, if in cell A1 I have 8 then in cell B1 I want a zero, if in cell A1 I have 10 then in cell B2 I want 2. I know its just a case of =A1 - 8 to get the answer but the tricky part is if the number is 8 or below I want 0.

    It is to work out my overtime so obviously everything over 8 hours is overtime and anything below is 0.
    Any help or advice is appreciated.

    Regards
    Alan

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =MAX(0,A1-8)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    or
    =IF(A1-8<=0,0,A1-8)

  4. #4
    Registered User
    Join Date
    06-16-2008
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72
    Thanks very much NBVC, that is exactly what I wanted.
    Could you explain what the 'MAX' actually does?

    Thanks
    Alan

  5. #5
    Registered User
    Join Date
    06-16-2008
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72
    I just got a 0 no matter which number I typed in Martin.

    EDIT
    Sincere appologies Martin, I wrote the formula down wrong! It also worked like a charm.

    Alan
    Last edited by AlanWade; 06-25-2008 at 02:59 PM.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by AlanWade
    Thanks very much NBVC, that is exactly what I wanted.
    Could you explain what the 'MAX' actually does?

    Thanks
    Alan
    The Max() function will return the maximum of the arguments within the function.

    In this case it will return the larger of 0 or A1-8

    so if A1=7, then A1-8=7-8 which equals -1.. so the Max will return 0 since its larger than -1... but if A1 = 10, then A1-8=2 which is the larger...

  7. #7
    Registered User
    Join Date
    06-16-2008
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72
    Ok, got it thanks for the expaination.

    Regards
    Alan

+ 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