Results 1 to 6 of 6

I have two columns of data that I need parse data from every 1 second to every 10 minutes.

Threaded View

  1. #1
    Registered User
    Join Date
    07-21-2012
    Location
    London, englan
    MS-Off Ver
    Excel 2007
    Posts
    7

    I have two columns of data that I need parse data from every 1 second to every 10 minutes.

    Hi everyone,

    I need a macro to parse a big data set. The data is logging every second, however I only require the values when it starts, then every 10 minutes after that. I process this file after its collected.

    I want to start at the first time in R2C1, copy both the time and the Baro value. So copy R2C1 & R2C2 (both cells) for that time. Then paste these values into another worksheet. Then I need the next value 10 minutes later & repeat it for the entire file. So one continuous loop until all values are pasted into the one worksheet.

    Time.........Baro
    23:14:13 1022.7
    23:14:14 1022.71
    23:14:15 1022.67
    23:14:16 1022.65
    23:14:17 1022.63
    23:14:18 1022.63
    23:14:19 1022.64
    23:14:20 1022.67
    23:14:21 1022.69
    23:14:22 1022.7
    23:14:23 1022.66
    23:14:24 1022.66
    23:14:25 1022.65
    23:14:26 1022.64
    23:14:27 1022.65
    23:14:28 1022.67
    23:14:29 1022.71
    23:14:30 1022.72
    23:14:31 1022.7
    23:14:32 1022.65
    ............ ...........
    23:24:14 1022.60
    ............ ...........

    Heres the code and the attachment I have so far. A loop may be easier.

    The macro I recorded copied the first set of values and pasted it into a new sheet, then I added 10 minutes to the initial value in the cell below. Then I copied that new value and searched for it, then copied the correct set. I basically need a loop. This method I am using is not efficient.

    Sub Macro4()
    '
    ' Macro4 Recorded
    
    Dim NewValue As String
    NewValue = Selection.Value
    
    'Paste Header Data and Initial Values to a New Sheet Called Parsed Data
        Sheets("Import Data").Activate
        Range("A1:B2").Select
        Selection.Copy
        Worksheets.Add(After:=Worksheets(1)).Name = "Parsed Data"
        Range("A1:B2").Select
        ActiveSheet.Paste
    
    'Add 10 minutes
        Range("A3").Select
        ActiveCell.FormulaR1C1 = "=R[-1]C+TIME(0,10,0)"
        Range("A3").Select
        Selection.Copy
    
    'Go to Data and find the new time value i.e. 10 minutes later as copied from above line
    Sheets("Import Data").Select
        Range("A2").Select
        Cells.Find(What:=NewValue, After:=ActiveCell, LookIn:=xlValues, LookAt _
            :=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
            False).Activate
    
    'Found the time in the cell, now select this cell and the cell next to it.
        ActiveCell.Resize(1, 2).Select
        Application.CutCopyMode = False
        Selection.Copy
     
    'Paste it into the parsed data sheet
        Sheets("Parsed Data").Select
        ActiveSheet.Paste
        Range("A4").Select
        Application.CutCopyMode = False
        
    'repeat
        ActiveCell.FormulaR1C1 = "=R[-1]C+TIME(0,10,0)"
        Range("A4").Select
        Selection.Copy
        Sheets("Import Data").Select
        Range("A2").Select
        Cells.Find(What:=NewValue, After:=ActiveCell, LookIn:=xlValues, LookAt _
            :=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
            False).Activate
        ActiveCell.Resize(1, 2).Copy   'Range("A1202:B1202").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Parsed Data").Select
        ActiveSheet.Paste
    End Sub
    Barometer Readings 2.xlsm
    Last edited by reesjordan; 06-16-2014 at 08:34 PM. Reason: Added more comments to code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Parse cell data into multiple columns
    By maldonadocj in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-05-2014, 08:16 AM
  2. How do I parse a single column of data into multiple columns?
    By stevenica in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-02-2011, 02:27 PM
  3. Parse data in column A to seperate columns
    By ianmorris1977 in forum Excel General
    Replies: 3
    Last Post: 11-30-2008, 08:42 AM
  4. Parse Data to Various Columns
    By jkareem@iupui.edu in forum Excel General
    Replies: 5
    Last Post: 07-12-2006, 03:55 PM

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