Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If Or Statements (XP)

    Having difficulty with the logic of an IF OR statement. In H1 I have 8:30. In I1 I have 7:30. In column F I have this formula =IF(E4>$H$1,E4-$H$1,"") which calculates the difference between time worked and the standard work day (H1). This formula will enter any overtime. If none, it returns a blank cell. However because of my schedule i have some days which are non-standard (I1). What I want to be able to do in column F is write a formula which will calculate any overtime, be it a standard work day or a short day. What I tried was =IF(OR(E4>$H$1,E4-$H1,E4>$I$1,E4-$I$1)). This does not work. What logic am I missing?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: If Or Statements (XP)

    You'll have to indicate whether a day is to be compared to a standard day or to a short day, otherwise each time you work less than a standard day, time worked would automatically be compared with a short day, which is not what you want, I suspect.
    Let's say that you enter an "x" in column F, next to time worked, if it is a short day.
    The formula would become
    <code>
    =IF(F4="x",IF(E4>$I$1,E4-$I$1,""),IF(E4>$H$4,E4-$H$4,""))
    </code>
    or
    <code>
    =IF(E4>IF(F4="x",$I$1,$H$1),E4-IF(F4="x",$I$1,$H$1),"")</code>

  3. #3
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If Or Statements (XP)

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •