Increment series without secqunce function

sohaila

New Member
Joined
Oct 25, 2015
Messages
37
Office Version
  1. 365
Platform
  1. Windows
Hello experts
Please help i want convert a number series like
1024-1030 to 1024,1025,1026,1027,1028,1029,1030 in rows with out excel sequence function is this possible?
DataResultwith out SEQUENCE function
1024-1030
1024​
1176-1190
1025​
963-993
1026​
1201-1210
1027​
1028​
1029​
1030​
1176​
1178​
1180​
1182​
1184​
1186​
1188​
1190​
963​
964​
965​
966​
967​
968​
969​
970​
971​
972​
973​
974​
975​
976​
977​
978​
979​
980​
981​
982​
983​
984​
985​
986​
987​
988​
989​
990​
991​
992​
993​
1201​
1202​
1203​
1204​
1205​
1206​
1207​
1208​
1209​
1210​

 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Is VBA an acceptable solution?
 
Upvote 0
If VBA is acceptable, here is some code to do what you want:
VBA Code:
Sub MySequencer()

    Dim lr As Long
    Dim r As Long
    Dim str As String
    Dim arr() As String
    Dim st As Long
    Dim ed As Long
    Dim s As Long
    
    Application.ScreenUpdating = False
    
'   Find last row in column A with data
    lr = Cells(Rows.Count, "A").End(xlUp).Row
    
'   Loop through all rows starting in row 2
    For r = 2 To lr
'       Split values and store start and ending values
        str = Cells(r, "A")
        arr() = Split(str, "-")
        st = arr(0)
        ed = arr(1)
'       Loop through values
        If ed >= st Then
            For s = st To ed
'               Populate column B
                Cells(Rows.Count, "B").End(xlUp).Offset(1, 0) = s
            Next s
        End If
    Next r
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0
Thanks joe4 for your solution but i want in formula solution if it is possible.
 
Upvote 0
You can do it with formulas if you add some helper cells:

Book1
ABCDEF
1DataResultRowLenStart
21024-10301024271022
31176-119010259151167
4963-99310262431939
51201-1210102755101146
61028
71029
81030
91176
101177
111178
121179
131180
141181
151182
161183
171184
181185
191186
201187
211188
221189
231190
24963
25964
26965
27966
28967
29968
30969
31970
32971
33972
34973
35974
36975
37976
38977
39978
40979
41980
42981
43982
44983
45984
46985
47986
48987
49988
50989
51990
52991
53992
54993
551201
561202
571203
581204
591205
601206
611207
621208
631209
641210
65 
Sheet3
Cell Formulas
RangeFormula
D2D2=ROW()
E2:E5E2=1-MID(A2,FIND("-",A2),9)-LEFT(A2,FIND("-",A2)-1)
F2:F5F2=LEFT(A2,FIND("-",A2)-1)-D2
D3:D5D3=D2+E2
B2:B65B2=IF(ROW()>SUM(E:E)+1,"",ROW()+VLOOKUP(ROW(),$D$2:$F$5,3))


It's theoretically possible to include the D:F formulas in the B formula, but it would be a horrible mess. I tried for a while and gave up.
 
Upvote 0
in rows with out excel sequence function
Is that because you do not have the SEQUENCE function or for some other reason?

In any case please update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Assuming avoidance of Microsoft 365 functions you could try this. B3 formula may require confirmation with Ctrl+Shift+Enter before copying down in other versions.

21 05 21.xlsm
AB
1DataResult
21024-10301024
31176-11901025
4963-9931026
51201-12101027
61028
71029
81030
91176
101177
111178
121179
131180
141181
151182
161183
171184
181185
191186
201187
211188
221189
231190
24963
25964
26965
27966
28967
29968
30969
31970
32971
33972
34973
35974
36975
37976
38977
39978
40979
41980
42981
43982
44983
45984
46985
47986
48987
49988
50989
51990
52991
53992
54993
551201
561202
571203
581204
591205
601206
611207
621208
631209
641210
65 
66 
Sequences
Cell Formulas
RangeFormula
B2B2=REPLACE(A2,FIND("-",A2),9,"")+0
B3:B66B3=IFERROR(IF(ISNUMBER(MATCH(B2&"",REPLACE(A$2:A$5,1,FIND("-",A$2:A$5),""),0)), INDEX(REPLACE(A$2:A$5,FIND("-",A$2:A$5),9,""),MATCH(B2&"",REPLACE(A$2:A$5,1,FIND("-",A$2:A$5),""),0)+1)+0,B2+1),"")
 
Upvote 0
Clever approach Peter. But it's worth mentioning that if the ranges overlap, you'll get some strange results.
 
Upvote 0
it's worth mentioning that if the ranges overlap, you'll get some strange results.
Good point Eric. Not in the sample data but if that is a possibility I do have another idea (not too dissimilar to yours) but I'll wait to see what the OP's response so far is.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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