Split Series

ayazgreat

Well-known Member
Joined
Jan 19, 2008
Messages
1,151
Hi

I want to split a column series as per its left three 3 digits into different columns as example given below.

Excel Workbook
ABCDE
1Series210214810803
22100021000214008100080300
32100121001214018100080301
42100221002214028100080302
52100321003214038100080303
621004210042140481000
721005210052140581000
82140081000
921401
1021402
1121403
1221404
1321405
1481000
1581000
1681000
1781000
1881000
1981000
2081000
2180300
2280301
2380302
2480303
Sheet1


Could any body please help me ?
 
Thanks it works great
Can it be possile to add each series count as mentioned below

Excel Workbook
ABCDEFG
1Series210214810803808809
221000667478
321001210002140081000803008080080900
421002210012140181000803018080180901
521003210022140281000803028080280902
621004210032140381000803038080380903
7210052100421404810008080480904
82140021005214058100080805
9214018100080806
1021402
1121403
1221404
1321405
1481000
1581000
1681000
1781000
1881000
1981000
2081000
2180300
2280301
2380302
2480303
2580800
2680801
2780802
2880803
2980804
3080805
3180806
3280900
3380901
3480902
3580903
3680904
Sheet1
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
change
Rich (BB code):
        With .Resize(1, 1)
            For i = 0 To UBound(x)
                .Offset(, i).Value = x(i)
                .Offset(1, i).Resize(UBound(y(i))).Value = _
                Application.Transpose(y(i))
            Next
        End With
to
Rich (BB code):
        With .Resize(1, 1)
            For i = 0 To UBound(x)
                .Offset(, i).Resize(2).Value = _
                Application.Transpose(Array(x(i), UBound(y(i))))
                .Offset(2, i).Resize(UBound(y(i))).Value = _
                Application.Transpose(y(i))
            Next
        End With
 
Upvote 0
Seiya

Can it be possibel that result of your macro "Numbers Store as Text" of all splited series ?
 
Upvote 0
you can also try...

Code:
Option Explicit
Sub tst()
Dim a, b, c() As String, x As Integer, m As Integer, ii As Integer, i As Integer, ac As New Collection, r As Range
With Application
Set r = Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
    With r
    a = Evaluate("=INDEX(LEFT(" & .Address & ",3),0,1)")
    b = .Value
    End With
For i = 1 To UBound(a, 1)
    On Error Resume Next
    ac.Add a(i, 1), CStr(a(i, 1))
Next
ReDim c(1 To UBound(a, 1), 1 To ac.Count): x = 2
For i = 1 To ac.Count
c(1, i) = ac.Item(i)
    Do Until IsError(.Match(ac.Item(i), a, 0))
    ii = .Match(ac.Item(i), a, 0): x = x + 1
    c(x, i) = b(ii, 1)
    a(ii, 1) = Empty
    Loop
c(2, i) = x - 2: m = .Max(x, m): x = 2
Next
End With
Range("C1").Resize(m, UBound(c, 2)) = c
End Sub
 
Upvote 0
Thanks facethegod it works perfect but i do not want thier counts to be number store as text

<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 10pt; FONT-FAMILY: Arial,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><TBODY><TR style="HEIGHT: 17px"><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">6</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">6</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">7</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">4</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">7</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">8</TD></TR></TBODY></TABLE>
 
Upvote 0
Thanks facethegod it works perfect but i do not want thier counts to be number store as text

<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 10pt; FONT-FAMILY: Arial,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><TBODY><TR style="HEIGHT: 17px"><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">6</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">6</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">7</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">4</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">7</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">8</TD></TR></TBODY></TABLE>

try...

Code:
Option Explicit
Sub tst()
Dim a, b, c() As String, x As Integer, m As Integer, ii As Integer, i As Integer, ac As New Collection, r As Range
With Application
Set r = Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
    With r
        a = Evaluate("=INDEX(LEFT(" & .Address & ",3),0,1)")
        b = .Value
    End With
For i = 1 To UBound(a, 1)
    On Error Resume Next
    ac.Add a(i, 1), CStr(a(i, 1))
Next
ReDim c(1 To UBound(a, 1), 1 To ac.Count): x = 2
For i = 1 To ac.Count
c(1, i) = ac.Item(i)
    Do Until IsError(.Match(ac.Item(i), a, 0))
        ii = .Match(ac.Item(i), a, 0): x = x + 1
        c(x, i) = b(ii, 1)
        a(ii, 1) = Empty
    Loop
c(2, i) = x - 2: m = .Max(x, m): x = 2
Next
End With
Range("C1").Resize(m, UBound(c, 2)) = c
    With Range("C2").Resize(1, UBound(c, 2))
    .Value = .Value2
    End With
End Sub
 
Upvote 0
Thank you very much facethegod, I have made some addition in these lines.

Code:
Range("B1").Resize(m, UBound(c, 2)) = c
With Range("B1").Resize(m, UBound(c, 2))
.HorizontalAlignment = xlCenter
End With
    With Range("B2").Resize(1, UBound(c, 2))
    .Value = .Value2
    .Font.Bold = True
    
    End With
 
Upvote 0
Seiya

Can it be possibel that result of your macro "Numbers Store as Text" of all splited series ?
Rich (BB code):
        With .Resize(1, 1)
            For i = 0 To UBound(x)
                .Offset(, i).Resize(2).Value = _
                Application.Transpose(Array(x(i), UBound(y(i))))
                With .Offset(2, i).Resize(UBound(y(i)))
                    .NumberFormat = "@"
                    .Value = Application.Transpose(y(i))
                End With
            Next
        End With
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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