Combine multiple rows of data into one long string

pocquet

Board Regular
Joined
Aug 21, 2013
Messages
118
Hi guys,

I have a data set that is by its nature has multiple lines for a single reference number.

So for example:

Code:
[FONT=Calibri][COLOR=#000000][/COLOR][/FONT][TABLE]
<caption>[B]Qry_Master_Vendor_Output_L1[/B]</caption><thead>[TR]
[TH="bgcolor: #c0c0c0"][FONT=Calibri][COLOR=#000000]CPVDescription[/COLOR][/FONT][/TH]
[TH="bgcolor: #c0c0c0"][FONT=Calibri][COLOR=#000000]Vendor[/COLOR][/FONT][/TH]
[/TR]
</thead><tbody>[TR]
[TD][FONT=Calibri][COLOR=#000000]Sludge disposal services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Sludge treatment services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Sludge transport services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Sludge removal services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Treatment and disposal of foul liquids.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Refuse incineration services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Ash disposal services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Household-refuse disposal services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
[TR]
[TD][FONT=Calibri][COLOR=#000000]Urban solid-refuse disposal services.[/COLOR][/FONT][/TD]
[TD][FONT=Calibri][COLOR=#000000]1000049892[/COLOR][/FONT][/TD]
[/TR]
</tbody><tfoot></tfoot>[/TABLE]

Is it possible to combine all results in CPV descirption so they appear as a single row eg:

Code:
[TABLE="width: 328"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]CPVDescription[/TD]
[TD]Vendor[/TD]
[/TR]
[TR]
[TD]Sludge disposal services.Sludge treatment services.Sludge transport services.Sludge removal services.Treatment and disposal of foul liquids.Refuse incineration services.Ash disposal services.Household-refuse disposal services.Urban solid-refuse disposal services.[/TD]
[TD]1000049892[/TD]
[/TR]
</tbody>[/TABLE]

But with spaces rather than the period?

Thanks
 
HI,

effectively i want a query in access OR a macro in excel that concatenates the field CPVvendor description where it finds multiple vendors,

The reason is I need to create a One to One relationship that will allow me to look up the amount spent with the supplier over a year.

The CPVendor I then use later on to perform a Keyword search for end users in excel that then brings back the required hits (I already have this working)

Thanks

Poc
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Often, I don't ask why someone wants to do something because it tends to complicate arriving at a solution; especially if the request seems straight forward. In this case, I probably should have.
The reason is I need to create a One to One relationship that will allow me to look up the amount spent with the supplier over a year.
Given your sample data, I fail to see how concatenating all these words is necessary to calculate a spend for a supplier for a time period. This is easily accomplished with a Totals query that Groups By supplier.

I'm away for a while and will do my best to follow your replies, but I may not be able to respond rapidly.
 
Upvote 0

Forum statistics

Threads
1,221,813
Messages
6,162,117
Members
451,743
Latest member
matt3388

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