+ Reply to Thread
Results 1 to 2 of 2

Filter and extract data that occurs every 30 seconds.

  1. #1
    Registered User
    Join Date
    03-09-2021
    Location
    Canada
    MS-Off Ver
    2102
    Posts
    1

    Filter and extract data that occurs every 30 seconds.

    I have a large data file from a test where I send a voltage that is increment by 1mv every 30s from 0-5V) to test the accuracy of my system. The computer outputs a file that has over 70000 rows of data but all I am really concerned with is data that occurs every 30s. Is there a way to filter for only the data that aligns with the 30s interval and ideally having around 5000 rows of data?

    Currently what I have done is extract the seconds by using: =RIGHT(TEXT(A1, "hh:mm:ss"),2)

    Now what I need to do is create some VBA script to sort through the data from top to bottom and extract only the rows that occur every 30s. Due to the fact that sometimes the seconds aren't perfectly noted as 30s, I need it to also figure out the closest number to 30s or 60s (00) in the event the scan happens at say 31, or 59. I have attached a sample workbook with only 100 rows for reference.

    I am stuck and I really don't want to manually sort through 70000 lines of data, any help is greatly appreciated...
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Re: Filter and extract data that occurs every 30 seconds.

    This is going to take a lot of explaining.

    First of all, I converted the data to a table. Tables copy formulas down automatically and formulas can be expressed as column headers so they are easier to understand.

    I replaced your second formula with =SECOND([@Time])

    I also calculated Date, Hour and Minute using similar formulas.

    The main plan of attack is to look at the seconds in groups of minutes. Furthermore, I want to look at zero past the minute and 30 past the minute.

    So, I computed two “bases” The Date + hour + minute and the Date + Hour + Minute + 30 seconds. (Columns G & H)

    Then I took the absolute difference between the actual time and the two bases. (Columns I & J)

    Columns K & L get the minimum of the differences between the time and the two bases.

    Columns M & N are what old-school Excel would have called array formulas. That is, they work on an array of cells instead of individual cells. The column M formula is:
    =MATCH([@[Zero Sec Min]],IF([@[Zero Base]]=[Zero Base],[Zero Second Diff],FALSE),0)

    We will work the formula from the “inside out.” The if statement says look at the rows where the base is equal to the base on this specific row. Ignore all other rows. This array or range limits the Match. So even tough there may be multiple same minimum values for other minutes, match will only find the row for this specific minute.

    Finally the formula in Column O is true of the minimum of the zero base or the minimum of the 30-second base matches the row.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ 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. Add to a Sum in a Specific Cell Each Time a Filter and Count Occurs Using VBA
    By shaht96 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2018, 11:46 AM
  2. Extract all data to new workbook then filter and extract to new worksheets
    By graphicgoose in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2014, 08:18 PM
  3. Replies: 1
    Last Post: 01-20-2014, 09:31 AM
  4. Replies: 2
    Last Post: 03-18-2013, 12:43 PM
  5. VBA extract external source data every 2 seconds
    By jc0r in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2008, 09:34 AM
  6. Replies: 2
    Last Post: 02-17-2006, 08:15 PM
  7. [SOLVED] formula to extract specific data if match occurs
    By jerry in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2005, 08:06 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