+ Reply to Thread
Results 1 to 5 of 5

Merging time and date data

  1. #1
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Merging time and date data

    Hello,

    I hope somebody can help me with this. I've uploaded a sample of my dataset below. The table to the left is the original data, the table to the right shows the way I would like to transform it.

    As you can see on column A, date and time measures have been taken every 80 seconds with associated values for columns B to D. I would like to transform my dataset in the following way:

    Intead of having date and time measures every 80 seconds, I would like to have them every 240 seconds (4 minutes). That means rows should be merged by three for the whole dataset. As for the values in columns B to D, that would imply summing them every three rows to a single row. I have left the formulas in the cells for the table on the right hand side for better understanding.

    Is there a way ro automat this process for a whole dataset with thousands of rows?

    Any input is appreciated!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: Merging time and date data

    Your output is incorrect.
    Total for column A is 987, total for column G is 914

    Also between 6/19/18 10:40:00 and 10:43:59 the total for B is 60+62+60 not 0.
    In F2 10:44:00 hasn't even occurred yet the activity totals 182.

    Base something on this:

    in F2
    =INDEX(A$2:A$21,(ROW()-2)*3+1,1)
    copy down the column, you'll need to add a finishing date for the last date in the column or replace the blank in the last date with a date that will never occur, e.g. 12/31/2999 or something like that.

    in G2
    =SUMIFS(B$2:B$21,$A$2:$A$21,">="&$F2,$A$2:$A$21,"<"&$F3)
    and copy down the column
    Last edited by Special-K; 03-14-2019 at 11:09 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Merging time and date data

    With your setup, you are ignoring values in Row2 and the last row.

    I'd propose that you group by first whole minute to next 2 rows as one.

    To do this grouping, I'd add helper column to source table with following formula.
    =IF(SECOND(A2)=0,A2,E1)

    Copy down.

    Then use pivot table to summarize data. See attached sample.
    Attached Files Attached Files
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  4. #4
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Re: Merging time and date data

    Thanks for your reply @Special-K, but formula on G2 isn't working. Note that, for each time, its associated ACTIVITY_X, ACTIITY_Y and ACTIVITY_Z measures are calculated from an interval corresponding to: [previous time + 1 seconds to actual time].

    Example: For the second line with time 6/19/18 10:41:20 values for ACTIVITY_X, ACTIITY_Y and ACTIVITY_Z correspond to a sampling interval of [6/19/18 10:40:01 to 6/19/18 10:41:20].

    The first row of the output table will have 0 for ACTIVITY_X, ACTIITY_Y and ACTIVITY_Z values since I'm missing the values from the two previous time intervals, but that's no problem.

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,910

    Re: Merging time and date data

    The date/time values appeared to be text, so I first converted them to numeric values and applied custom formatting: m/d/yy h:mm:ss
    The following yields the same values as those manually placed in G2:I8, with the exception of the three zeros in row 2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If the three zeros are needed the formula could be modified to read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. Replies: 2
    Last Post: 05-12-2014, 10:24 PM
  2. Merging date AND time collumns into one timeline
    By WernerBatMan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-04-2013, 04:06 AM
  3. Formatting date/time (merging two columns)
    By glanglois822 in forum Excel General
    Replies: 3
    Last Post: 01-11-2013, 02:23 PM
  4. Replies: 2
    Last Post: 05-11-2010, 08:42 AM
  5. Merging time data
    By squidgy_wiji in forum Excel General
    Replies: 0
    Last Post: 06-03-2009, 07:36 AM
  6. Merging separate date and time columns into one
    By Gadgets in forum Excel General
    Replies: 5
    Last Post: 07-26-2006, 04:24 PM
  7. merging columns - one date, one time
    By batfish in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-28-2005, 12:05 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