Loop through data and build an array

2077delta

Board Regular
Joined
Feb 17, 2002
Messages
241
I have a sheet of data, not in table form, more like a report with blocks of data that repeat themselves as you go down the page. I want to go through the data and extract some of the data and copy it to a different worksheet. I was thinking of using the Find function to locate where each block of data starts (Find "Employee No."). I would then want to get the data offset 0 rows and 2 columns (Employee Name) and offset 5 rows and 4 columns, 5 rows and 5 columns, 5 rows and 6 columns, 5 rows and 7 columns and 6 rows and 7 columns (the payroll data), to build a table that looks like this:

Joe Greene 3251.23 721.43 218.57 25.12 2286.11
Deacon Jones 3516.67 801.33 266.82 31.48 2417.04
So on and so forth

I understand the best way to do this is to build an array then paste it into my spreadsheet. Obviously, I'm not really sure how I do that. Any help would be greatly appreciated as I have several other tasks I could apply this same routine to.
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Steve_

Board Regular
Joined
Apr 28, 2010
Messages
167
Its a safe bet that we will need more information and likely an example of the data, particularly its layout.
 

2077delta

Board Regular
Joined
Feb 17, 2002
Messages
241
Gladly, but, pardon my lack of knowledge, I don't seem to be able to paste in a screen shot and I don't know how to attach the file or somehow transfer the data on the worksheet into this thread.
 

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
2077delta,

We can not tell what worksheet(s), cells, rows, columns, your raw data is in.

And, we can not tell what the results should look like.

Can you post a screen shot of what your data looks like?

Section B at this link has instructions on how to post a screen shot: https://www.mrexcel.com/forum/board-...forum-use.html

You cannot upload files to the site, however there are add-ins available here https://www.mrexcel.com/forum/about-...tachments.html that enable you to include sample data in the post

Alternately, you could upload a copy of your file to a free site such as www.box.com. or www.dropbox.com.

Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.

Include a detailed explanation of what you would like to do referring to specific cells, rows, columns and worksheets.

If the workbook contains confidential information, you could replace it with generic data.
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,048
Office Version
2010
Platform
Windows
Okay, two things...

1) Can you post another sheet showing what you want outputted from that same data you just posted?

2) Your posted sheet shows rows with values like "1 of 37", "2 of 37", "3 of 37", and so on all in rows by themselves. Are those values physically on your data worksheet or are they some kind of page markers that are not really mixed into your actual data?
 

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
2077delta,

Your link to your workbook is not working?

We would like to see what your raw data workbook/worksheets look like, and, we would like to see what the resulting worksheet, manually formatted by you, should look like.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,680
Messages
5,488,228
Members
407,632
Latest member
varunwalla

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top