DEV Community

Cover image for #140 — Generate Continuous Arrays
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

#140 — Generate Continuous Arrays

Problem description & analysis:

There is a column of serial numbers (No), as shown in the figure below:

source table

Task: Now we want to use the two numbers in each row to expand into continuous number intervals, like this:

expected results

Solution:

Use SPL XLL and enter the following code:

=spl("=E(?1).news((a=No.split(""-"").(int(~)),to(a(1),a(2)));~:No)",A1:A3)
Enter fullscreen mode Exit fullscreen mode

Code explanation: Loop through each row, and split No with the minus sign, and then convert the split numbers to an integer sequence and assign it to the variable a, and finally form a continuous sequence of numbers with a(1) and a(2). The function news means expanding each row into multiple rows according to the number of members of the number sequence, and the numeric member is the value of No in the new row.


Download esProc Desktop for FREE and instantly reshape your data with SPL XLL!!! 🚀✨⬇️

✨SPL download address: esProc Desktop FREE Download

✨Plugin Installation Method: SPL XLL Installation and Configuration

✨References to other rich Excel operation cases: Desktop and Excel Data Processing Cases

✨YouTube FREE courses: SPL Programming

Top comments (1)

Collapse
 
judith677 profile image
Judith-Excel-Sharing

🔥 Join the discussion and share your experience!

Discord
Reddit