I'm attempting to automate Excel in a way that will save me countless hours of tedious data entry. Here's my problem.
We need to print barcodes for all of our inventory, which includes 4,000 variants each with a specific quantity.
Shopify is our e-commerce platform and they do not support customized exports; however, can export a CSV of all variants, which includes an inventory count column.
We use Dymo for our barcode printing hardware/software. Dymo will only print one label per row (it ignores the quantity column).
Is there a way to automate excel to duplicate the row "x" number of times based on the value in the inventory column?
Here's a sample of the data:
- If Column N = 0, ignore and move to next row
- If Column N > 1, copy current row, "N" number of times (to a separate sheet)
I tried to find someone who had done something similar so that I could modify the code, but after an hour of searching I'm still right where I started. Thank you in advance for the help!
David beat me to it but an alternate approach never hurt anyone.
Consider the following data
With this function
Produces the following output on sheet2
The caveats with this code is that there can be no empty fields in the Quantity column. I used D so feel free to substitute N for your case.
Should be enough to get you started:
Might be a bit late to answer, however this could help others. I have tested this solution on Excel 2010. Say: "Sheet1" is the name of the sheet where your data is located and "Sheet2" is the sheet where you want your repeated data. Assuming you have these sheets created, try the below code.
This solution is slightly modified version of David Zemens solution.