+ Reply to Thread
Results 1 to 7 of 7

How do I get the difference in time between 2 cells in this type of date-time cells?

  1. #1
    Registered User
    Join Date
    05-14-2016
    Location
    Netherlands
    MS-Off Ver
    office 2016
    Posts
    6

    How do I get the difference in time between 2 cells in this type of date-time cells?

    Hi,

    I have a big data (thousands of rows) excel file where each row is assigned a time (as shown below).
    I want to easily calculate the difference in time between 2 cells every other row (just as I filled in column C manually for the first 3 below).
    So I want the difference in time between row 1&2 3&4 5&6 7&8 etc. etc.
    The format of the date-time cells are:
    Custom dd/mm/yyyy hh:mm

    Any help would be greatly appreciated


    A B C
    1 2015.03.23 14:30
    2 2015.03.23 18:30 04:00
    3 2015.03.23 19:30
    4 2015.03.23 20:17 00:47
    5 2015.03.23 21:30
    6 2015.03.24 01:00 03:30
    7 2015.03.24 02:00
    8 2015.03.24 03:00
    9 2015.03.24 03:30
    10 2015.03.24 08:00
    11 2015.03.24 09:00
    12 2015.03.24 10:00
    13 2015.03.24 11:00
    14 2015.03.24 14:30



    edit: hmm when posted it does not seem to align the columns right, I hope you still understand.
    Last edited by rudy van eekelen; 05-14-2016 at 07:35 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,434

    Re: How do I get the difference in time between 2 cells in this type of date-time cells?

    You can put this formula in cell C2:

    =IF(MOD(ROWS($1:2),2)=0,B2-B1,"")

    (I assume your date/time values are in column B). Format the cell using a Custom Format of [hh]:mm, then copy down.

    NOTE: You may need to use a semicolon ( ; ) instead of the commas ( , )

    Hope this helps.

    Pete

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How do I get the difference in time between 2 cells in this type of date-time cells?

    Enter this formula in B2 and copy down as needed:

    =IF(ISEVEN(ROW()),A2-A1,"")

    You may have to replace the commas with semi-colons.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: How do I get the difference in time between 2 cells in this type of date-time cells?

    Welcome to the forum.

    To convert the times in column A to Excel readable times enter this formula in B1 and fill down and format as date and time.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    To subtract times on every second row enter this in C2 and fill down formatted as [h]:mm
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    A
    B
    C
    1
    2015.03.23 14:30
    23/03/2015 14:30
    2
    2015.03.23 18:30
    23/03/2015 18:30
    4:00
    3
    2015.03.23 19:30
    23/03/2015 19:30
    4
    2015.03.23 20:17
    23/03/2015 20:17
    0:47
    5
    2015.03.23 21:30
    23/03/2015 21:30
    6
    2015.03.24 01:00
    24/03/2015 1:00
    3:30
    7
    2015.03.24 02:00
    24/03/2015 2:00
    8
    2015.03.24 03:00
    24/03/2015 3:00
    1:00
    9
    2015.03.24 03:30
    24/03/2015 3:30
    10
    2015.03.24 08:0
    24/03/2015 8:00
    4:30
    11
    2015.03.24 09:0
    24/03/2015 9:00
    12
    2015.03.24 10:0
    24/03/2015 10:00
    1:00
    13
    2015.03.24 11:0
    24/03/2015 11:00
    14
    2015.03.24 14:3
    24/03/2015 14:03
    3:03
    <---------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

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How do I get the difference in time between 2 cells in this type of date-time cells?

    Paste into B2 and fill down

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How do I get the difference in time between 2 cells in this type of date-time cells?

    Quote Originally Posted by newdoverman View Post
    To convert the times in column A to Excel readable times enter this formula in B1 and fill down and format as date and time.
    =--SUBSTITUTE(A1,".","/")
    I'm assuming these are true date/times in a regional format (Netherlands).

  7. #7
    Registered User
    Join Date
    05-14-2016
    Location
    Netherlands
    MS-Off Ver
    office 2016
    Posts
    6

    Re: How do I get the difference in time between 2 cells in this type of date-time cells?

    Edit: I will post this in a different thread, so others may find it easier.




    Thank you everybody for the amazing answers! I got this working now

    Now I only have 1 step left:

    I sorted a different part of the data from low to high (where in this case "-27.49" is the lowest and "16.14" is the highest) as part of it shown below.
    Now I would like a histogram from the data where everything is sorted in bins of half an hour. so the first bin would be from 15-45 minutes, second bin 45-75 minutes etc. up to 14 hour (which is the maximum time for a value)

    When I try picking a histogram from this raw data (transferred to a new sheet) I get a blanc graph.

    Thanks in advance!

    p.s. sorry for asking "dumb" questions, I am not used to this type of data handling, and especially not in excel 2016 (used to work with old versions)




    -27.49 08:30:00
    -21.6 15:00:00
    -15.93 06:00:00
    -14.98 09:30:00
    2.29 01:00:00
    2.29 02:30:00
    2.31 02:00:00
    2.31 00:30:00
    2.31 02:30:00
    2.32 01:30:00
    2.32 00:30:00
    2.33 01:00:00
    2.33 01:00:00
    6.79 01:00:00
    7.11 01:30:00
    7.31 00:30:00
    10.35 09:30:00
    12.77 01:00:00
    13.15 02:00:00
    16.14 01:30:00
    Last edited by rudy van eekelen; 05-14-2016 at 08:52 PM.

+ 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 to Calculate Total Hours from 2 date cells and 2 time cells in military time.
    By psunursingguy21 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-07-2015, 06:46 PM
  2. time difference - text cells ?
    By Lukael in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-09-2014, 06:34 AM
  3. Calculation of time difference between the Start date & time & End Date & time
    By Harry Jones in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-17-2012, 03:54 PM
  4. [SOLVED] Caculating the Time difference from Start & end date/time excludin weekends & non ofce hrs
    By Harry Jones in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-08-2012, 06:25 AM
  5. [SOLVED] Subtract date/time from data/time and get difference in minutes
    By zit1343 in forum Excel General
    Replies: 2
    Last Post: 06-18-2012, 11:23 AM
  6. Time difference between two cells using criteria
    By Devi S in forum Excel General
    Replies: 5
    Last Post: 04-17-2012, 07:12 AM
  7. Calculate time difference between cells
    By sky in forum Excel General
    Replies: 3
    Last Post: 01-23-2006, 07:15 AM

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