SEPARATE LARGE COLUMN INTO 4 COLUMNS

rikvny02

Board Regular
Joined
Aug 9, 2022
Messages
95
Office Version
  1. 365
Platform
  1. Windows
I have a large list of addresses in column "A". I would like to separate them into 4 columns. Each address is separated by a blank row. The main issue occurs when an address has 4 lines of data instead of 3. Everything gets shifted. I have tried an offset formula and also the WRAPROWS formula. I can't seem to get past the forth row of data. Can someone help? Maybe this can be solved easier with a loop in which starts back at Column "C" after each blank row. please see the below example.

1731510085905.png
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try the code below (only tested on random data)

VBA Code:
Sub rikvny02()
    Dim myCell As Range
    Application.ScreenUpdating = False
  
    For Each myCell In Columns(1).SpecialCells(2).Areas
        Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(, myCell.Rows.Count).Value = Application.Transpose(myCell.Value)
    Next myCell
  
End Sub
 
Upvote 0
Amended as the data starts in row 3

VBA Code:
Sub rikvny02B()
    Dim myCell As Range
    Application.ScreenUpdating = False
  
    For Each myCell In Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(2).Areas
        Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(, myCell.Rows.Count).Value = Application.Transpose(myCell.Value)
    Next myCell
  
End Sub
 
Upvote 0
Solution
Here's a formula option. Try:
Book1
ABCDEF
1
2
3Name1Name1Street1Address1
4Street1Name2Street2Address2
5Address1Name3ATT:3Street3Address3
6Name4Street4Address4
7Name2
8Street2
9Address2
10
11Name3
12ATT:3
13Street3
14Address3
15
16Name4
17Street4
18Address4
Sheet9
Cell Formulas
RangeFormula
C3:F6C3=LET( data,A3:A18, r,SCAN(1,data,LAMBDA(a,b,IF(b<>"",a,a+1))), c,SCAN(0,data,LAMBDA(a,b,IF(b<>"",a+1,0))), IFNA(INDEX(data,XMATCH(SEQUENCE(MAX(r))&"|"&SEQUENCE(,MAX(c)),r&"|"&c)),"") )
Dynamic array formulas.
 
Upvote 0
Amended as the data starts in row 3

VBA Code:
Sub rikvny02B()
    Dim myCell As Range
    Application.ScreenUpdating = False
 
    For Each myCell In Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(2).Areas
        Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(, myCell.Rows.Count).Value = Application.Transpose(myCell.Value)
    Next myCell
 
End Sub
The results continue transposing the address horizontal across (ex. columns "G:XFD) the sheet. I would expect it to continue vertical starting in column "c".
 
Upvote 0
The results continue transposing the address horizontal across (ex. columns "G:XFD) the sheet. I would expect it to continue vertical starting in column "c".
Then your cells aren't truly blank/empty if you used the code in post 3

With

Test Workbook .xlsb
ABCDE
1Address
2
37996 Support Ln SE
47997 Support Ln SE
5
68336 Engine Avenue NW
7311 Partner Street
8508 Sugar Ave
95189 Loss Street
102501 Dinosaur Avenue
118109 Hydrant St E
12
13277 Push Avenue
14877 Authority Lane
15164 Sofa Lane
16
17948 Melon Ln N
18566 Lip Boulevard
1919 Glass Ln
209608 Bubble Street E
21743 Memory St
223605 Icicle Lane
23561 Reward Ln
24
25954 Yard Boulevard
262368 Copper Lane SE
27685 Mom Avenue
28
29993 Rest Street
30932 Toothpaste Ln
31831 Fig Ave NW
325302 Sun Street
Sheet9


The code produces the below with the code posted

Test Workbook .xlsb
ABCDEFGHI
1Address
27996 Support Ln SE7997 Support Ln SE
37996 Support Ln SE8336 Engine Avenue NW311 Partner Street508 Sugar Ave5189 Loss Street2501 Dinosaur Avenue8109 Hydrant St E
47997 Support Ln SE277 Push Avenue877 Authority Lane164 Sofa Lane
5948 Melon Ln N566 Lip Boulevard19 Glass Ln9608 Bubble Street E743 Memory St3605 Icicle Lane561 Reward Ln
68336 Engine Avenue NW954 Yard Boulevard2368 Copper Lane SE685 Mom Avenue
7311 Partner Street993 Rest Street932 Toothpaste Ln831 Fig Ave NW5302 Sun Street
8508 Sugar Ave
95189 Loss Street
102501 Dinosaur Avenue
118109 Hydrant St E
12
13277 Push Avenue
14877 Authority Lane
15164 Sofa Lane
16
17948 Melon Ln N
18566 Lip Boulevard
1919 Glass Ln
209608 Bubble Street E
21743 Memory St
223605 Icicle Lane
23561 Reward Ln
24
25954 Yard Boulevard
262368 Copper Lane SE
27685 Mom Avenue
28
29993 Rest Street
30932 Toothpaste Ln
31831 Fig Ave NW
325302 Sun Street
Sheet9


or

Test Workbook .xlsb
A
1Address
2
3a
4b
5
6c
7d
8e
9f
10g
11h
12
13i
14j
15k
16
17l
18m
19n
20o
21p
22q
23r
24s
25t
26u
27v
28
29w
30x
31y
32z
Sheet9


Results in

Test Workbook .xlsb
ABCDEFGHIJKL
1Address
2ab
3acdefgh
4bijk
5lmnopqrstu
6cwxyz
7d
8e
9f
10g
11h
12
13i
14j
15k
16
17l
18m
19n
20o
21p
22q
23r
24s
25t
26u
27v
28
29w
30x
31y
32z
Sheet9
 
Last edited:
Upvote 0
I wish we could mark more than one post as the solution. Your formula works perfectly. Thank you.

An option for formula solution and macro solution I think would be very helpful to all.
 
Upvote 0
Amended as the data starts in row 3

VBA Code:
Sub rikvny02B()
    Dim myCell As Range
    Application.ScreenUpdating = False
 
    For Each myCell In Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(2).Areas
        Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(, myCell.Rows.Count).Value = Application.Transpose(myCell.Value)
    Next myCell
 
End Sub
[/CODE
[/QUOTE]
incredible thank you
@

MARK858 you solution works great. Thank you​

 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,589
Messages
6,173,227
Members
452,505
Latest member
Neeraj1990

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