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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

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,030
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,070
Messages
5,484,507
Members
407,444
Latest member
Trick

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top