# Parse Data from one dimensional array into a 2 dimensional array.

1. ## Parse Data from one dimensional array into a 2 dimensional array.

OK, Obviously I know the answer to the question, but I would like to see what method other people would use to get the same result. So if you want to answer purely to help, I don't need it as I already have the code to do what I want, I just think that it can be done better and would be interested as to the different angles each person would choose to attack something like this.

OK, the problem, a simple issue of parsing data.

I have a one dimensional array in column A with 56 cells of data. The data needs to be broken into a two dimensional array, 14 cells of data over 4 columns alternatively. ie, 1 - 14 in column D, 29 - 42 in column E, 15 - 28 in column F, 43 - 56 in column G, and have this repeated by 5 columns.

I have attached a file showing the out come of the array.

Cheers Dave

2. ## Re: Parse Data from one dimensional array into a 2 dimensional array.

Are the numbers across the top row (1-15) and in the white columns (1-14) generated as part of this, or just there for reference?

Pete

3. ## Re: Parse Data from one dimensional array into a 2 dimensional array.

Hey Pete. No, those number are just for reference. Just the yellow filled cells are part of this problem, but there is an empty column every 4th column, hence the 5 column repeat.

Cheers Dave

4. ## Re: Parse Data from one dimensional array into a 2 dimensional array.

Hi Dave,

I'm sure you're not really looking for a formula solution, but I thought I've give you one anyway !

In the attached file I've moved your tables across so that I could put this formula in D2:

=IF(MOD(COLUMNS(\$D:D),5)=0,"",INDEX(\$A:\$A,MOD(ROWS(\$1:1)-1,14)+IF(MOD(COLUMNS(\$D:D),5)=2,2,IF(MOD(COLUMNS(\$D:D),5)=3,1,(MOD(COLUMNS(\$D:D)-1,5))))*14+1))

This can be copied across to Q2, then D2:Q2 copied down to row 15.

It would be slightly different if you wanted to see the reference numbers.

Hope this helps.

Pete

5. ## Re: Parse Data from one dimensional array into a 2 dimensional array.

Hey Pete, Unfortunately it is an array in memory, so that can't be used. And to answer the last question, I don't need to see the reference numbers.

Thanks for answer though, rep for you.

Dave

6. ## Re: Parse Data from one dimensional array into a 2 dimensional array.

No one else? Hmmm

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

#### 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