# How to convert bin data to single column?

#### sm5007

##### New Member
Is there a way to convert data that is already binned to one single column of data? I have a few hundred lines of data that look like this:

Number - Freq.
1 - 5
2 - 3
3 - 2
.
.
.

I would like them converted back into a single column like this:

1
1
1
1
1
2
2
2
3
3

There are too many to do manually, so I need some way to automate it. Any suggestions? Thanks

### Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Assuming that your data is in Column A and there is nothing in Column B you could use this code

Code:
``````Sub binconv()
Dim R1 As Integer, R2 As Integer, MyNbr As Integer, MyCount As Integer, MyStr As String
Dim K As Integer
R1 = 1: R2 = 1
Do While Cells(R1, 1) <> ""
MyStr = Cells(R1, 1)
MyNbr = Val(Left(MyStr, InStr(MyStr, "-") - 1))
MyCount = Val(Right(MyStr, InStr(MyStr, "-"))) * -1
For K = 1 To MyCount
Cells(R2, 2) = MyNbr
R2 = R2 + 1
Next K
R1 = R1 + 1
Loop
End Sub``````

Afterward you can delete Column A if you no longer need it for anything.

HTH

Replies
2
Views
168
Replies
6
Views
322
Replies
1
Views
803
Replies
4
Views
1K
Replies
3
Views
955

1,203,069
Messages
6,053,352
Members
444,655
Latest member
didr

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

### Which adblocker are you using?

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

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