+ Reply to Thread
Results 1 to 5 of 5

Three Level Nested Time Calculation IF Statement

  1. #1
    Registered User
    Join Date
    05-08-2019
    Location
    Big Sky Country
    MS-Off Ver
    O365
    Posts
    3

    Three Level Nested Time Calculation IF Statement

    Hello,

    While not an Excel guru, I am decent with Excel formulas but am stymied by what I feel is a fairly involved calculation involving dates for timekeeping. I have gotten what I feel is a pretty elaborate IF statement going, but now I need to add a third IF statement and am stuck. What I need is:
    If the weekday is Tu/Th, calculate hours against expected 7.75
    If the weekday is Mo/We, calculate hours against expected 9
    If the weekday is Fr, calculate hours against expected 6.5
    I have the following that is working for different hours on Tu/Th and Mo/We/Fr:
    A1 is the work date (date format), F1 is the hours worked (General format)
    =IF(OR(WEEKDAY("A1")=5,WEEKDAY("A1")=3),(IF(F1-9<-9,,F1-9)),(IF(F1-7.75<-7.75,,F1-7.75)))
    I have the following that is working for just Friday:
    A1 is the work date (date format), F1 is the hours worked (General format)
    =IF(WEEKDAY("A1")=6,(IF(F1-6.5<-6.5,,F1-6.5)))
    I am stuck how to nest these separate statements together so I can have the three calculation variations occur. Can someone give me a hand getting this working?

    Thanks in advance!

    Chris

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Three Level Nested Time Calculation IF Statement

    Does this work?

    First...
    IF(F1-9<-9 then F1 must be < 0 so we can change this
    IF(F1-9<-9,,F1-9)
    to
    IF(F1<0,0,F1-9)
    Based on your other value depending what day it is try this

    IF(F1<0,0,F1-LOOKUP(A1,{1,2,3,4,5,6,7},{0,9,7.75,9,7.75,6.5,0}))

    The LOOKUP takes the day of the week (Sun is 1) and returns a value from the second part {0,9,7.75 etc} depending on that day so Wed (day 4) would return 9 (the second nine in the inline array)
    Last edited by Special-K; 05-08-2019 at 12:13 PM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    05-08-2019
    Location
    Big Sky Country
    MS-Off Ver
    O365
    Posts
    3

    Re: Three Level Nested Time Calculation IF Statement

    Hi - thanks for the quick response! I think this is pretty close, but the end result is just the value of F1 as opposed to the calculated over/under that the original IF statements returned. If it makes any difference, the A1 field is a verbose date (i.e., 5/3/2019 8:19:33 AM). The final result of the calculation needs to be the over/under of the expected work hours which is not working in the suggested formula though I really like using the lookup.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Three Level Nested Time Calculation IF Statement

    Please Login or Register  to view this content.
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    05-08-2019
    Location
    Big Sky Country
    MS-Off Ver
    O365
    Posts
    3

    Re: Three Level Nested Time Calculation IF Statement

    This worked perfectly! Thanks a ton for the help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. qualitative risk level calculation
    By distord in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-14-2019, 04:41 AM
  2. Significance level calculation
    By Sectio in forum Excel General
    Replies: 2
    Last Post: 11-05-2016, 03:03 PM
  3. Nested IF statement error. Nested True statement is not triggering
    By Lucas7040 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2016, 11:41 AM
  4. Level calculation according to the various offset
    By anindya.zen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-25-2016, 06:35 AM
  5. Nested level limit exceeded with IF statements
    By SimonDorfman in forum Excel General
    Replies: 5
    Last Post: 11-02-2011, 05:14 PM
  6. Nested If Statement using Time formatted cells
    By tcowen61 in forum Excel General
    Replies: 5
    Last Post: 09-04-2011, 05:52 AM
  7. Limited IF Nested Level functions.
    By Skyscraper in forum Excel General
    Replies: 1
    Last Post: 04-08-2005, 08:06 AM

Tags for this Thread

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