Transpose and repeat formula or script

sneaky911

New Member
Joined
Feb 5, 2016
Messages
19
I have the following data and need a formula or script that will transpose at each change in location. I have several thousand cells in column A to search through. My data is not consistently every 5th cell. (Locations= 001, 002, 003 etc.)

Before:

M-G-001-A
M-G-001-B
M-G-001-C
M-G-001-D
M-G-002-A
M-G-002-B
M-G-002-C
M-G-002-D
M-G-003-A
M-G-003-B
M-G-003-C
M-G-003-D

After:

M-G-001-A
M-G-001-BM-G-001-CM-G-001-D
M-G-002-AM-G-002-BM-G-002-CM-G-002-D
M-G-003-AM-G-003-BM-G-003-CM-G-003-D

<colgroup><col><col span="3"></colgroup><tbody>
</tbody>

<colgroup><col><col span="3"></colgroup><tbody>
</tbody>

<colgroup><col></colgroup><tbody>
</tbody>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
If you have exactly 4 entries before a change, then

Book1
ABCDEFG
1
2M-G-001-AM-G-001-AM-G-001-BM-G-001-CM-G-001-D
3M-G-001-BM-G-002-AM-G-002-BM-G-002-CM-G-002-D
4M-G-001-CM-G-003-AM-G-003-BM-G-003-CM-G-003-D
5M-G-001-D
6M-G-002-A
7M-G-002-B
8M-G-002-C
9M-G-002-D
10M-G-003-A
11M-G-003-B
12M-G-003-C
13M-G-003-D
Sheet4
Cell Formulas
RangeFormula
D2=IFERROR(INDEX($B$2:$B$13,4*ROWS($1:1)-3+COLUMNS($A:A)-1),"")
 
Upvote 0
If you have exactly 4 entries before a change, then
ABCDEFG
1
2M-G-001-AM-G-001-AM-G-001-BM-G-001-CM-G-001-D
3M-G-001-BM-G-002-AM-G-002-BM-G-002-CM-G-002-D
4M-G-001-CM-G-003-AM-G-003-BM-G-003-CM-G-003-D
5M-G-001-D
6M-G-002-A
7M-G-002-B
8M-G-002-C
9M-G-002-D
10M-G-003-A
11M-G-003-B
12M-G-003-C
13M-G-003-D

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Worksheet Formulas
CellFormula
D2=IFERROR(INDEX($B$2:$B$13,4*ROWS($1:1)-3+COLUMNS($A:A)-1),"")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
I apologize but how do I alter this for exactly 3 entries before a change?
 
Upvote 0

Book1
BCDEF
1M-G-001-AM-G-001-AM-G-001-BM-G-001-C
2M-G-001-BM-G-002-AM-G-002-BM-G-002-C
3M-G-001-CM-G-003-AM-G-003-BM-G-003-C
4M-G-002-A   
5M-G-002-B
6M-G-002-C
7M-G-003-A
8M-G-003-B
9M-G-003-C
Sheet3
Cell Formulas
RangeFormula
D1=IFERROR(INDEX($B$1:$B$9,3*ROWS($1:1)-3+COLUMNS($A:A)),"")
D4=IFERROR(INDEX($B$1:$B$9,3*ROWS($1:4)-3+COLUMNS($A:A)),"")
E4=IFERROR(INDEX($B$1:$B$9,3*ROWS($1:4)-3+COLUMNS($A:B)),"")
F4=IFERROR(INDEX($B$1:$B$9,3*ROWS($1:4)-3+COLUMNS($A:C)),"")
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,851
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top