+ Reply to Thread
Results 1 to 4 of 4

Asking for help to set up a time sheet using If(OR and MOD

  1. #1
    Registered User
    Join Date
    01-26-2017
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    2

    Asking for help to set up a time sheet using If(OR and MOD

    I could use some help please.

    I am setting up a time sheet with four possible hour entries:
    Start/Lunch Out/Lunch In/Stop And daily totals
    I want to Total the daily hours using Clock values (60 minutes) – not using results in Base 100 (i.e. I want results to be 15 and 30 – NOT 25 and 50).

    We all know that Excel makes this difficult by having the TIME formats include the Date - so that 8:00(AM) becomes 1/8/1900 12:00:00AM upon entry into a Time formatted cell.

    So I did a work around – and I need some help “tweeking” it. Please.

    For this request here are some sample data:
    Column C D E F G H
    Row 9 8:00 12:00 12:30 16:30 TOT-in Base 100 =INT(G9)

    Row 27 8:00 12:20 12:50 17:00 TOT-in Base 100 =INT(G27)

    I
    Row 9 =MROUND(MOD(G9,1)*60,15)/100

    Row 27 =MROUND(MOD(G27,1)*60,15)/100

    I am using an IF(OR formula (L) to test the contents of the cell containing the results of the MOD formula (I).

    Following is an abbreviated copy (Non-Nested) of my Nested IF(OR formula is in column (L):
    L
    Row 9 =IF(OR(I9=0.00,I9=0.60),0.00,"error")
    Row 27 =(IF(OR(I27=0.70,I27=0.30),0.30,”error”)


    What I am encountering is this:
    1) Excel keeps changing the decimals within my formula – i.e. 0.00
    becomes 0 and 0.30 become 0.3. And I wonder if this might be
    preventing my getting good results – because -
    2) All but the first test IF(I9=0) [I] - after Excel changes the decimal - in
    my nested IF(OR formula, returns FALSE – (and so “error”).
    (All parts of my nested If(ORs are coded identically and the
    formatting of all cells in columns (I) are identical as are the
    formatting of all cells in columns (L) ).

    My questions:
    1) Does Excel permit the testing of the results of one formula (MOD) by
    another formula (IF(OR)?
    2) How do I get Excel to stop changing my test data within the formula
    (or does it matter)?
    3) Is there a special way to format the cells (both the Data cells and the
    Formula cells) so that the IF(OR formula can “see” it for testing
    purposes?
    I’ve tried several of the formats so far - with no affect.

    Any help would be greatly appreciated.

    Frustrated.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,148

    Re: Asking for help to set up a time sheet using If(OR and MOD

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,394

    Re: Asking for help to set up a time sheet using If(OR and MOD

    JillieQ,

    Set cols C - G formats as custom "[h]:mm"

    Following formula in G9 will then give you the total daily hours using Clock values:

    =IF(C9="",0,IF(C9<D9,D9-C9,1-C9+D9))+IF(E9="",0,IF(E9<F9,F9-E9,1-E9+F9))

    Works as folows:
    If there is no Start time in Col C, the pre-break session is Zero. If the employee does not come back after lunch, the post-break session is Zero.
    If the employee is on a shift that does not go through midnight, it adds the (clocking off - return from lunch),and adds (break for lunch - start time).
    If the employee works a Shift running past midnight, the start time could be later than the lunchbreak, or the time they return from the break could be later than the stop time. Where that happens, formula deducts the start time from twenty four hours, then adds the hours for the second day (e.g. starting 23:00 and going for meal break at 03:00 becomes (24:00-23:00)+3:00 = 04:00 hours)

    Hope that solves your problem

    Ochimus

  4. #4
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,394

    Re: Asking for help to set up a time sheet using If(OR and MOD

    JillieQ,

    Set cols C - G formats as custom "[h]:mm"

    Following formula in G9 will then give you the total daily hours using Clock values:

    =IF(C9="",0,IF(C9<D9,D9-C9,1-C9+D9))+IF(E9="",0,IF(E9<F9,F9-E9,1-E9+F9))

    Works as folows:
    If there is no Start time in Col C, the pre-break session is Zero. If the employee does not come back after lunch, the post-break session is Zero.
    If the employee is on a shift that does not go through midnight, it adds the (clocking off - return from lunch),and adds (break for lunch - start time).
    If the employee works a Shift running past midnight, the start time could be later than the lunchbreak, or the time they return from the break could be later than the stop time. Where that happens, formula deducts the start time from twenty four hours, then adds the hours for the second day (e.g. starting 23:00 and going for meal break at 03:00 becomes (24:00-23:00)+3:00 = 04:00 hours)

    Hope that solves your problem

    Ochimus

+ 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. Need Sheet that Calculates/Tracks Staff Time-Off & Paid Time Off Accrual
    By mikecann11 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 05-30-2017, 02:07 PM
  2. [SOLVED] time sheet help, format TIME and formula based on the actual time entered.
    By bh mng in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-06-2016, 01:10 PM
  3. Time sheet that splits normal time and a half and double time
    By leewat in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-09-2016, 07:52 PM
  4. Budgeting out percentages of time from a time card calculation sheet
    By mhadaway in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-24-2015, 05:05 PM
  5. [SOLVED] Creating a Time elapsed Spread Sheet that records and posts time...
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2013, 07:11 PM
  6. Replies: 5
    Last Post: 04-18-2013, 11:31 AM
  7. Replies: 2
    Last Post: 03-15-2013, 08:50 PM

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