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

judith677

Judith-Excel-Sharing

Posted on August 15, 2024

#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.

💖 💪 🙅 🚩
judith677
Judith-Excel-Sharing

Posted on August 15, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related