View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dawn[_4_] Dawn[_4_] is offline
external usenet poster
 
Posts: 8
Default Concatenate columns, variable number of rows

I have a report that returns multiple rows per ID number. The columns always
stay the same. The number of rows per ID number is variable. I would like
to group the info per ID number into one cell. If the number of rows was
constant I could concatenate easily. But each ID number could have one row
or a hundred rows, it is completely variable. Can VBA be used to
concatenate?

The way the report currently looks, it gives the ID number in the first row,
then each subsequent row has the ID number blank until there is a new ID
number to show. This report comes out of a database.

Sample data:

ID Country Number
1234-5678 US 123456
[blank] GB 789123
[blank] IT 456789
4567-8912 US 23456
8912-3456 EP 1234567
[blank] US 8912345
[blank] JP 456789
[blank] CN 123456789
2345-6789 [blank]

So in this example what I want to end up with is two columns, on row per ID
number:

ID Related Matters (one cell)
1234-5678 US 123456; GB 789123; IT 456789
4567-8912 US 23456
8912-3456 EP 1234567; US 8912345; JP 456789; CN 123456789
2345-6789 [blank]

Thanks in advance for any help/ideas anyone can give!