Decoding data and tabeling it in order

jesi0303

New Member
Joined
Jan 8, 2011
Messages
13
I have a list of data, which is coded by a number following a decimal point for each entry. I need to decode the data and have it tabulated by the code, with each entry listed in an order. Is this possible? See an example below....

Data I have:
12.11
15.12
17.44
19.12
25.11

What I want (ignore the dashes!):
.11 .12 .44
12
-----15
---------17
-----19
25

I have 11 different codes, and usually about 400 entried in a data column.

The macro below is what I am working with now, but it lists everything without spaces between, such that that the above data would look like?

This macro gives me (again, ignore the dashes!):
.11 .12 .44
12--15--17
25--19

The macro:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Dim Rng As Range<o:p></o:p>
Dim Dn As Range<o:p></o:p>
Dim n AsLong<o:p></o:p>
Dim Q As Variant<o:p></o:p>
Dim oMax AsLong<o:p></o:p>
If Target.Count = 1 And Target.Address(0, 0) = "A1" Then<o:p></o:p>
Set Rng = Range(Range("C7"), Range("c" & Rows.Count).End(xlUp))<o:p></o:p>
ReDim Ray(1 To Rng.Count, 1 To 11)<o:p></o:p>
With CreateObject("scripting.dictionary")<o:p></o:p>
.CompareMode = vbTextCompare<o:p></o:p>
ForEach Dn In Rng<o:p></o:p>
If Not .Exists(Dn.Value) Then<o:p></o:p>
n = n + 1<o:p></o:p>
.Add Dn.Value, Array(n, 2)<o:p></o:p>
Ray(1, n) = Dn.Value<o:p></o:p>
Ray(2, n) = Dn.Offset(, -1)<o:p></o:p>
Else<o:p></o:p>
Q = .Item(Dn.Value)<o:p></o:p>
Q(1) = Q(1) + 1<o:p></o:p>
Ray(Q(1), Q(0)) = Dn.Offset(, -1)<o:p></o:p>
oMax = Application.Max(Q(1), oMax)<o:p></o:p>
.Item(Dn.Value) = Q<o:p></o:p>
End If<o:p></o:p>
Next<o:p></o:p>
Range("E1").Resize(oMax, 11) = Ray<o:p></o:p>
End With<o:p></o:p>
End If<o:p></o:p>

EndSub<o:p></o:p>
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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