+ Reply to Thread
Results 1 to 9 of 9

Subtract times over 48 hours

Hybrid View

  1. #1
    Registered User
    Join Date
    12-29-2011
    Location
    Gaithersburg, MD
    MS-Off Ver
    Excel 2003
    Posts
    12

    Subtract times over 48 hours

    I have been given good ideas and suggestions , but I cannot get this to work. I do not want to have to enter the date as well as the time in each cell. This is too labor intensive. I like the idea of using +1 , +2 e.t.c as the time passes from one day to the next. I show two subjects receiving a drug. The time of dosing in the evening (21:05) is shown in cell B2 and this time has to be subtracted from each of the the time intervals shown 0, 4, 8...............

    I cannot get this to work across 48 hours. I enclose an example in Excel 2007. I just cannot see what I am doing wrong. Could I be advised.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Subtract times over 48 hours

    Are the times you show in your sample, the times that you need calc'd? If not, could you show some sample answers and how you got them please?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,658

    Re: Subtract times over 48 hours

    Is this what your looking for??
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  4. #4
    Registered User
    Join Date
    12-29-2011
    Location
    Gaithersburg, MD
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Subtract times over 48 hours

    Hello! Thank you for your contribution. This is exactly what I am looking for. I am looking at the data structure at the moment to see if I understand it well. I am asking my self why is this working?

    Angus

  5. #5
    Registered User
    Join Date
    12-29-2011
    Location
    Gaithersburg, MD
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Subtract times over 48 hours

    Willem: I have found out that it works for some of the blood sampling times tims, but not all of them. The problem begins at row 12 when the time of blood sampling at 0 time is prior to time of drug administration: this is quite common in clinical studies. I enclose the data set of times. Comments are welcome to resolve this problem. I do not understand the routine well.
    Attached Files Attached Files

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Subtract times over 48 hours

    This video on YouTube (ExcellsFun) uses this syntax and explains it.

    http://www.youtube.com/watch?v=oVBPtVgBxzY
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,658

    Re: Subtract times over 48 hours

    Excel cannot calculate with negative times.
    I adjusted the first 2 (yellow) cels
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-29-2011
    Location
    Gaithersburg, MD
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Subtract times over 48 hours

    Willem: many thanks .......there has to be a conditional statement. I do not know the Excel language. I will try it with the full data set later today to see if there are other problems to be addressed.

    Angus

  9. #9
    Registered User
    Join Date
    12-29-2011
    Location
    Gaithersburg, MD
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Subtract times over 48 hours

    I have got it to work now. But I have a question. If you look at the worksheet you sent to me as an example I find that something odd has happened to cell C9. it used to show -0.08. It has changed and I do not understand why.
    Attached Files Attached Files

+ 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. Subtract times over 48 hours
    By angusmdmclean in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-25-2013, 07:20 PM
  2. Replies: 2
    Last Post: 03-02-2013, 10:57 AM
  3. [SOLVED] Formula to work out hours between 2 dates and times.. MINUS Out Of Hours
    By chris.m in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-30-2012, 08:11 AM
  4. subtract decimal hours from formatted hours
    By each in forum Excel General
    Replies: 2
    Last Post: 10-28-2008, 05:16 PM
  5. Calculation of hourly rate times hours times 1.5
    By Newbusinessbod in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-06-2005, 12:50 PM

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