Combining Data Into A Single Row

bornsteij

New Member
Joined
Oct 8, 2009
Messages
10
This is how the spreadsheet looks now....

Claim ID Rule # Payer<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
100 6474 Medicaid-NY
100 3200 Medicaid-NY
<o:p> </o:p>
<o:p> </o:p>
What I want to get to:
<o:p> </o:p>
Claim ID Rule # Payer<o:p></o:p>
100 6474; 3200 Medicaid-NY
<o:p> </o:p>
Once it's in the format above I'll use a text to columns to separate the rule numbers. What's the easiest way to get the data in this format?

Thanks,

Jake
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this:-
I assumed that for every uniqueClaim I/D the payer was the same, as per your example.
This will place in columns starting column "D".
Code:
[COLOR="Navy"]Sub[/COLOR] MG20Apr30
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] oMax [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Q
[COLOR="Navy"]Dim[/COLOR] Temp [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A2"), Range("A" & rows.Count).End(xlUp))
ReDim ray(1 To Rng.Count, 1 To Columns.Count)
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Not .Exists(Dn.value) [COLOR="Navy"]Then[/COLOR]
        n = n + 1
        .Add Dn.value, Array(n, 2)
        ray(n, 1) = Dn.value: ray(n, 2) = Dn(, 2): ray(n, 3) = Dn(, 3)
[COLOR="Navy"]Else[/COLOR]
        Q = .Item(Dn.value)
        Temp = ray(Q(0), Q(1) + 1)
        Q(1) = Q(1) + 1
        ray(Q(0), Q(1)) = Dn(, 2):
        ray(Q(0), Q(1) + 1) = Temp
        oMax = Application.Max(oMax, Q(1))
        .Item(Dn.value) = Q
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
Range("D2").Resize(.Count, oMax + 1) = ray
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,678
Members
452,937
Latest member
Bhg1984

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