+ Reply to Thread
Results 1 to 9 of 9

total sum of hours gathered per day

  1. #1
    Registered User
    Join Date
    07-25-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    8

    total sum of hours gathered per day

    I cannot figure out what is the problem in my formula. I am only getting correct answer if all the hours is equal to 1.

    My formula

    =IF(AND(B12<$O$17, C12>=$O$16), $O$21, IF(AND(B12<$O$17, AND(C12>=$O$17, C12<=$O$13)), C12-$O$17, IF(AND(B12<$O$17, AND(C12>$O$13, C12<$O$14)), $O$20, IF(AND(B12<$O$17, C12<= $O$17 ),$O$22, IF(AND(B12<$O$17, AND(C12>=$O$13, C12<=$O$16)), (C12 - $O$17)-$O$19, IF(AND(AND(B12>=$O$17, B12<=$O$13), AND(C12>=$O$17, C12<=$O$13)), C12-B12, IF(AND(AND(B12>=$O$17, B12<=$O$13),AND(C12>$O$13, C12<$O$18)), $O$13-B12, IF(AND(AND(B12>=$O$17, B12<=$O$13),AND(C12>=$O$18, C12<=$O$16)), (C12-B12)-$O$19, IF(AND(AND(B12>=$O$17, B12<=$O$13), C12>$O$16), ($O$16-B12)-$O$19, IF(AND(AND(B12>$O$13, B12<$O$18), AND(C12>=$O$18, C12<=$O$16)), C12-$O$18, IF(AND(AND(B12>$O$13, B12<$O$18), AND(C12>$O$13, C12<$O$18)), $O$22, IF(AND(AND(B12>=$O$18, B12<=$O$16), AND(C12>=$O$18, C12<=$O$16)), C12-B12, IF(AND(AND(B12>$O$13, B12<$O$14), C12>$O$16), $O$20, $O$16-B12)))))))))))))

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: total sum of hours gathered per day

    No idea and not much to work on.

    I'd start by removing the superfluous ANDs ... you don't need AND(AND(... unless some of the ANDs should be ORs.

    Then use Evaluate Formula to see what's going on.

    If you want further help, I suggest you post a sample workbook indicating what you expect to see based on the input to the formula.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-25-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: total sum of hours gathered per day

    how can I attach my document here for you to check?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: total sum of hours gathered per day

    Go Advanced; Manage Attachments or click on paperclip icon.

  5. #5
    Registered User
    Join Date
    07-25-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: total sum of hours gathered per day

    Ok here is it
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-25-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: total sum of hours gathered per day

    try having a time in as 8:00 and time out as 17:00 then the total will be 15. If you change the time in and time out the total hours are definitely wrong

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: total sum of hours gathered per day

    try having a time in as 8:00 and time out as 17:00
    Why? That looks like an 8 hour working day with 1 hour for lunch. And your formula, surprisingly, returns 8 hours Regular Time. Where do you get 15?

    If I'm honest, I think this is way over-engineered. I'd start with the basics ... finish time - start time ... and then build up the factors individually. At least then you'll see where it starts to go wrong. I usually start with simple formulae for each element then combine them into a complex formula once I know each bit works.

    But start by removing the redundant ANDs; that will reduce the size of the formula and make it more readable.

    Sorry, as it stands, I'm out.

    Regards, TMS

    ---------- Post added at 11:03 AM ---------- Previous post was at 10:59 AM ----------

    Oh, and you need to format Total Hours in D27 as [h].mm ... well, in fact, any hours that will exceed 24 need to be formatted that way.

    Regards, TMS

  8. #8
    Registered User
    Join Date
    07-25-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: total sum of hours gathered per day

    Thanks TMShucks It solved my problem
    the only solution is provide [h] in h.mm thanks a lot

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: total sum of hours gathered per day

    @ paulalvin

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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