I am trying to create an array with the interfaces for networking devices. The array of interfaces is an undetermined size and there can be 0-3 slashes in the interface. Below is an example of the interfaces for one device.
A1: G1/0/1, G1/1/1 (first inteface) B1: G1/0/24, G1/1/4 (last interface)
I am seeking C1:
G1/0/1
G1/0/2
G1/0/3
G1/0/4
G1/0/5
G1/0/6
G1/0/7
G1/0/8
G1/0/9
G1/0/10
G1/0/11
G1/0/12
G1/0/13
G1/0/14
G1/0/15
G1/0/16
G1/0/17
G1/0/18
G1/0/19
G1/0/20
G1/0/21
G1/0/22
G1/0/23
G1/0/24
G1/1/1
G1/1/2
G1/1/3
G1/1/4
I do not want to use VBA. This is tricky because Excel does not have built-in support for using Sequences with an Array. Also, I need to append the prefix for the interfaces, which may change based upon the inteface pair. Futhermore, the amount of slashes in the interface may be from 0-3.
I found a similar problem at: https://www.reddit.com/r/excel/comments/tnl3q6/how_to_string_together_multiple_sequence_arrays/
I tried using
=LET(
a, TRANSPOSE(TEXTAFTER(D2#,"/",2) - TEXTAFTER(D1#,"/",2) + 1),
b, ROW(a),
c, TRANSPOSE(b),
d, --(b>=c),
e, MMULT(d, a),
f, SUM(a),
g, SEQUENCE(f),
h, XMATCH(g-1, e,-1),
I, IFERROR(INDEX(e,h),0),
j, g - I,
j)
which allows me to generate a sequence using an array. This works for finding the interface number, but I do not know how to add the prefix specific to that interface group using this formula. I heard that it may also be possible to use VSTACK to get a similar result, but I do not know how to use VSTACK.
One idea I had was to create an array that finds when the sequence array iterates to the next sequence using:
=LET(
SEQ_1,LET(
a, TRANSPOSE(TEXTAFTER(D2#,"/",2) - TEXTAFTER(D1#,"/",2) + 1),
b, ROW(a),
c, TRANSPOSE(b),
d, --(b>=c),
e, MMULT(d, a),
f, SUM(a),
g, SEQUENCE(f),
h, XMATCH(g-1, e,-1),
I, IFERROR(INDEX(e,h),0),
j, g - I,
j), IF(INDEX(SEQ_1,SEQUENCE(COUNTA(SEQ_1)))>INDEX(SEQ_1,SEQUENCE(COUNTA(SEQ_1))-1), FALSE, TRUE))
By using this, I can iterate through a prefix array.
D1:
=TRANSPOSE(INDEX(TEXTSPLIT(TEXTJOIN(",", TRUE, TEXTSPLIT(A2, ", ") & "," & TEXTSPLIT(B2, ", ")), ","), SEQUENCE(COUNTA(TEXTSPLIT(TEXTJOIN(",", TRUE, TEXTSPLIT(A2, ", ") & "," & TEXTSPLIT(B2, ", ")), ","))/2,1,1,2)))
D2:
=TRANSPOSE(INDEX(TEXTSPLIT(TEXTJOIN(",", TRUE, TEXTSPLIT(A2, ", ") & "," & TEXTSPLIT(B2, ", ")), ","), SEQUENCE(COUNTA(TEXTSPLIT(TEXTJOIN(",", TRUE, TEXTSPLIT(A2, ", ") & "," & TEXTSPLIT(B2, ", ")), ","))/2,1,2,2)))

