+ Reply to Thread
Results 1 to 5 of 5

Time Calculation

  1. #1
    Registered User
    Join Date
    02-05-2004
    Posts
    48

    Time Calculation

    Object - to determine the time lapse (in hrs/mm) between a given set of times.

    Cell M - start time. I use a drop down menu to generate this value - it is in 15 minute increments as is formatted h:mm

    Cell N - lunch start. I use a drop down menu to generate this value - it is in 15 minute increments as is formatted h:mm

    Cell O - lunch end. I use a drop down menu to generate this value - it is in 15 minute increments as is formatted h:mm

    Cell P - finish time. I use a drop down menu to generate this value - it is in 15 minute increments as is formatted h:mm

    Cell R- hours worked =((P7-M7+(P7<M7))-(O7-N7+(O7<N7)))*24
    format - general

    This formula returns the correct result (hours worked) for some values and appears to add 24 hours for others. When I override the list function and manually input the times in cells M, N, O and P it always returns the correct result. I have checked the format of the list drop down times and they appear to be all uniform so I am puzzled at to why I get a different result between a manual input and using the list.

    Any help appreciated.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Time Calculation

    Can you post a sample file?
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    02-05-2004
    Posts
    48

    Re: Time Calculation

    Pls find attached.SAMPLE.xlsx

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Time Calculation

    Hi,
    If you go in FORMULAS > formula Auditing > Evaluate Formula and go step by step, you'll see that your "times" are treated as "string" by Excel
    For example, you'll have "21:45" < "5:30" which is TRUE for a string but FALSE for numbers.
    That's why you have incorrect results.

    I'm not sure why Excel consider your times as string,
    One quick fix is to replace your formula with this one to convert the strings to numbers :
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-05-2004
    Posts
    48

    Re: Time Calculation

    Thank you that formula appears to work.

    Am still puzzled as to why the calculation works with manual input.

+ 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. 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
  2. [SOLVED] Excel calculation for adding time and calculating remaining time
    By mark888 in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 01-12-2015, 12:55 PM
  3. [SOLVED] Excel calculation for adding time and calculating remaining time
    By mark888 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2015, 06:38 AM
  4. [SOLVED] Time entry on UserForm displaying inccorectly and calculation not working on the time.
    By Colin Smit in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-12-2014, 01:21 PM
  5. Payroll time sheet calculation where time exceeds 24 hours
    By Rolo1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-23-2014, 08:57 AM

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