Help creating columns based on count

wings516

New Member
Joined
Sep 6, 2014
Messages
3
So I have a label name and count name in the row next to it, I need to be able to take the label name and create "count" amount of times in one column, and I need to do it for all of the labels. Here is a screenshot of an example. I have about 4000 of these labels...

So basically, as an example, take the text in A2, looks at B2, C2 or D2 and create that many copies of the text into column form based on the count number.

It absolutely HAS to be in one column for my labeling software to process the data. Maybe I create a separate page to create multiple columns of the labels and then concatenate them into one page as a single column? I don't know...

Thank you so much for the help! This will save me COUNTLESS hours!

 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
wings516,

Welcome to MrExcel.

Here is a small piece of code that should hopefully do as you ask.
It does however assume that there is only one quantity in columns B,C or D.
It could be modified to add quantities if you wish.

In your example row 37, column D has value 2GF currently, that would be ignored and the label qty would be assumed to be 5.

Right click your sheet tab >> View Code >> paste the below code into the code pane.

Code:
Sub Label_List()
lr = Cells(Rows.Count, 1).End(xlUp).Row
Set Rng = Range("J1")
For r = 2 To lr
n = WorksheetFunction.Max(Range("B" & r & ":D" & r))
For i = 1 To n
Rng.Offset(i, 0) = Range("A" & r)
Next i
Set Rng = Rng.Offset(n, 0)
Next r
End Sub

Run the code by whatever means you wish e.g. for starters Alt+F8 select Label_List and run.

Hope that helps.
 
Upvote 0
lol... and here I was trying to use the standard excel functions...

If I could donate to you, I would be more than happy to... You may/may not be able to comprehend how many hours of copy and pasting you just saved me!!!!!! Works like an absolute charm, it even cuts out the Chars in the count area and only looks at the number... I would have NEVER thought of that code...
 
Upvote 0
You are most welcome.

Thanks for the feedback. If you are minded to toss a dollar into the next charity tin that gets rattled under your nose then so be it.
 
Upvote 0

Forum statistics

Threads
1,222,029
Messages
6,163,487
Members
451,838
Latest member
DonSlayer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top