+ Reply to Thread
Results 1 to 2 of 2

Time calculation

  1. #1
    Registered User
    Join Date
    01-19-2017
    Location
    Birmingham, England
    MS-Off Ver
    2013
    Posts
    10

    Time calculation

    Hi, this is the scenario I'm trying to solve.

    Between the hours of 06:00 - 19:00 we charge at rate 1.
    After 19:00 and before 06:00 we charge at rate 2.

    I'm creating a time calculator where you enter the start time and end time and it automatically calculates how many hours of which rate we should charge.

    I've managed to work everything else out, but am struggling when the end time goes past midnight (or rather more specifically, it works for any time between 24:00 - 24:59, but does not like from 01:00 onwards).

    So what I need it to work out is how many hours past 19:00. Can anyone help please? :-)

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Time calculation

    =and( cell with time > = time(6,0,0) , cell with time value < = time (19,0,0) )
    so that should test the rate 1

    now for rate 2

    =
    and( cell with time > = time(0,0,0) , cell with time value < time (6,0,0) )
    and( cell with time > time(19,0,0) , cell with time value <= time (0,0,0) )
    so that tests the time before and after midnight
    now add as an OR

    =OR(
    and( cell with time > = time(0,0,0) , cell with time value < time (6,0,0) )
    and( cell with time > time(19,0,0) , cell with time value <= time (0,0,0) )
    )

    Then you can combine in a IF

    but if you use

    =IF( and( cell with time > = time(6,0,0) , cell with time value < = time (19,0,0) ) ,rate 1 , rate 2 )

    if its not between 06:00 and 19:00 then it must be between 19:00 and 06:00
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    01-19-2017
    Location
    Birmingham, England
    MS-Off Ver
    2013
    Posts
    10

    Re: Time calculation

    Thanks for that. I think though that you're trying to solve the whole calculation for me? I've managed to (probably rather clumsily!) calculate the number of hours if the start time is before 06:00, and the number of hours between 06:00 - 19:00. So all I need is the formula that says "if the end time is after 19:00, the number of hours from that time to end time" regardless if it goes past midnight.

    I can't tell from what you've written, whether you're just addressing what I need or everything else too? :-)

+ 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
  6. [SOLVED]Time/Date calculation to check response time
    By tailz in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 09-01-2013, 10:20 AM
  7. Specific time period calculation from a time range
    By Khaldon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2011, 06:44 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