+ Reply to Thread
Results 1 to 4 of 4

Nested IF Statments

  1. #1
    Registered User
    Join Date
    09-16-2009
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2003
    Posts
    30

    Nested IF Statments

    I have the following formula as part of a timesheet:

    =IF(OR(WEEKDAY(A6=0),(M6="8 hrs max!")),0,IF(AND(WEEKDAY(A6)>1,WEEKDAY(A6)<7),((M6)*24)-8,((M6)*24)))

    Column A contains the days of the week. Two other columns contain the "Time in, Time out" fields and column M contains the total hours. This formula is working off the A and M columns on the timesheet. (The formula is suppose to give the number of hours greater than or less then 8 hrs and give a value of zero if the date field is empty or M contains the text "8 hrs max!

    Both IF statments work great separately, but when combined, the ((M6)*24)-8 part of the 2nd statment doesn't work. Can someone help on how to correct this?

    Thanks,
    Kirk

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Nested IF Statments

    Hi,

    Can you upload the workbook, or at least the relevant bit of it so that we can see the request in context. Also show what the actual result should be for a sample of the formulae.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    09-16-2009
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Nested IF Statments

    Sorry for the delay...I had to take a much needed break!

    (See the attached sample timesheet)
    In rows 7 and 8, the formula in column “N” does work and column “O” shows the correct hours over and under.

    In rows 5 and 6, I added “IF(WEEKDAY(A5=0),0” at the beginning of the formula. The reason for this was; if you delete the date out of “M2”, which removes the dates from column “A”, you get a “#Value!” error in columns N and O. I was trying to get rid of this error. I wanted a zero value to show so as not to confuse users.

    I’m trying to find a way to make the formula work AND get rid of the “#Value!”
    I hope my explanation wasn’t too confusing :-/

    Thanks, Kirk
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-16-2009
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Nested IF Statments

    Hello again,

    I found the working formula:
    =IF(A5="",0,IF(AND(WEEKDAY(A5)>1,WEEKDAY(A5)<7),((M5)*24)-8,((M5)*24)))

    It's always the simple things that throw me :-?

    Kirk

+ 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