+ Reply to Thread
Results 1 to 3 of 3

Loop macro to extract four values from dataset

  1. #1
    Registered User
    Join Date
    09-28-2018
    Location
    Huntsville, AL
    MS-Off Ver
    Office 2016
    Posts
    25

    Loop macro to extract four values from dataset

    I have a dataset of 80 samples. Each has 12 attributes (values). I want to extract only four values from each sample. All data is in Column A and the values follow the same order for each sample. I want to extract the values to Column F. I think I could write a macro with the “offset command” and a loop. I want to follow this pattern:
    1. Extract value from A1 to F1 (use offset 3 to return to source data and select A4)
    2. Extract value from A4 to F2 (use offset 6 to return to source data and select A10)
    3. Extract value from A10 to F3 (use offset 1 to return to source data and select A11)
    4. Extract value from A11 to F4
    5. Leave next two cells in Column F blank
    6. Move two cells down in source data to A13
    7. Repeat pattern until reaching end of dataset

    See attached example dataset with desired results in Column F. Thanks in advance! I am new to VBA.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    867

    Re: Loop macro to extract four values from dataset

    You *could* use a formula to do this. Put the following in F1:

    Please Login or Register  to view this content.
    Then you can copy it down to F480 to capture all 80 samples. You may also need to format column F as Date.

    WBD
    Excel 2016 on Windows 10, looking for rep!

  3. #3
    Registered User
    Join Date
    09-28-2018
    Location
    Huntsville, AL
    MS-Off Ver
    Office 2016
    Posts
    25

    Re: Loop macro to extract four values from dataset

    This works perfectly! Thank you! The export feature for the software I'm using is not very flexible so this formula literally saves me a couple hours of tedious copy and paste.

+ 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. Extract from dataset
    By joshua1990 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-03-2017, 12:15 PM
  2. Loop through values in one column and extract values from another?
    By sarah07282 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-31-2014, 06:01 AM
  3. Macro for procuring values from a dataset using different matching criteria
    By Raghukumarn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2014, 01:40 PM
  4. Need to extract specific XYZ coordinates from a dataset
    By pdog in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-02-2012, 02:52 PM
  5. Macro Loop to Extract Specific Values and Min/Max Values From Column/Rows Range
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-19-2010, 09:19 AM
  6. Macro Loop – Find Specific Times, Extract Date, Average Values of Times
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-25-2010, 02:50 PM
  7. Loop thru lines of text in a cell and extract specific values: please help?
    By Mslady in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2006, 10:22 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