Problem description & analysis:
There is a data table, which stores some information of products. The first column is the serial number, and the second column is the remaining quantity. The initial data is as follows:
Task: Now we want to copy each value in column ItemID n times according to the remaining quantity of product (i.e., the number in Qty Remaining column).
The requirements are:
Except for the first row (as the original row), the other copied rows only retain the value in column ItemID;
The remaining quantity of product 00003 is 0, this row will be no longer retained in the new table.
The expected result is as follows:
Solution:
Use SPL XLL and enter the following code:
=spl("=E(?1).news(#2;'ItemID',if(#==1,'QtyRemaining',null):'QtyRemaining',if(#==1,'InvoiceNo',null):'InvoiceNo')",A1:C4)
Code explanation: Copy each row n times according to the value in the second column to generate a new table sequence, where the values in the second and third columns use the if expression. If it is the first row, take the original value, otherwise take the null value.
Download esProc Desktop for FREE and simplify your workflow 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)
Share your experience with the communities and feel free to drop your thoughts below! 👇
🏆Discord
🏆Reddit