Generate Strings of Sequences of Natural Numbers from Start and End numbers

 

Problem description & analysis

In the Excel file below, column A and column B contain natural numbers that represent the start points and end points of sequences:

A

B

C

D

1

start

end

result

2

1

10

3

9

3

4

2

8

We are trying to generate strings of sequences of natural numbers from column A and column B and populate the results to column D, as shown below:

A

B

C

D

1

start

end

result

2

1

10

1,2,3,4,5,6,7,8,9,10

3

9

3

9,8,7,6,5,4,3

4

2

8

2,3,4,5,6,7,8

This computing scenario involves the basic uses of sequences.

Solution

Configure esProc add-in in Excel, restart the spreadsheet tool, and write formula =esproc("=to(?,?).concat@c()",A2,B2)in D2. You can also enclose the sequence with brackets: =esproc("=[to(?,?)]",A2,B2)

Then copy cell D2 or drag it down to cells below to complete the computation.

Q & A Collection

https://stackoverflow.com/questions/63842804/creating-an-array-in-excel-cell-from-start-and-end-number