DEV Community

Cover image for #45 — Copy Each Row N Times (N Is The Cell Value of The Specified column)
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

#45 — Copy Each Row N Times (N Is The Cell Value of The Specified column)

Problem description & analysis:
In the Excel table below, each row is a product, and the 3rd column is the quantity of the product.

original table
Task: Copy each row N times (N is the cell value of the 3rd column) and display values in the original 3rd column as empty. The expected result is as follows:

desired table
Solution:
Use SPL XLL to do this:

=spl("=?.conj(~3 * [~]).run(~3=null)",A2:F9)
Enter fullscreen mode Exit fullscreen mode

As shown in the picture below:

result table with code entered
Explanation:
conj()function concatenates members of a sequence. run() function modifies a sequence. “Integer N* a sequence” means copying members of a sequence N times.

Top comments (2)

Collapse
 
judith677 profile image
Judith-Excel-Sharing

Please feel free to download esProc Desktop and try it out ⬇️

🙌🏻SPL download address: scudata.com/download-Desktop

🍉Plugin Installation Method: c.scudata.com/article/1652061135502

🙌🏻References to other rich Excel operation cases: c.raqsoft.com/article/1651916536524

🍉SPL Programming (YouTube FREE courses): youtube.com/playlist?list=PLQeR-Ih...

Collapse
 
judith677 profile image
Judith-Excel-Sharing

Reach out to us if you have any Excel problems, and your cases may be listed in the next post of our series:

💎Discord: discord.gg/PVyKVa2J
💎Reddit: reddit.com/r/esProc_Desktop/