Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Concatenate info from columns into rows

Hie, can anyone help with the following:
COL A COL B COL C COL D
Unit 1 Unit 1 3B Unit 1: 3B, 5LH, 6RH
Unit 2 Unit 1 5LH Unit 2: 4B, 6LH, 7RH
Unit 3 Unit 1 6RH Unit 3: 5B, 4LH, 9RH
Unit 4 Unit 2 4B Unit 4
Unit 2 6LH
Unit 2 7RH
Unit 3 5B
Unit 3 4LH
Unit 3 9RH
Unit 4

What i've got are 4 unique units, each of which have a handing assigned to
them.
I need to concatenate the info in each column against each unique unit,
which gives the info on one row for each unit (COL D).
This is just an example. I may have unique units which have no handing info
against them (e.g. Unit 4) and therefore will appear on there own in COL D
with no handing info against them etc.

A macro to automate this process would be greatly appreciated.
Thanks
--
jj

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Concatenate info from columns into rows

Sub combinerows()

RowCountColA = 1
RowCountColD = 1
Do While Range("A" & RowCountColA) < ""
UnitNo = Range("A" & RowCountColA)
RowCountColB = 1
CombinedString = UnitNo & ": "
MyString = CombinedString
Do While Range("B" & RowCountColB) < ""
If Range("B" & RowCountColB) = UnitNo Then
'need to see if init string so a comma can be added
If MyString = CombinedString Then
MyString = MyString & Range("C" & RowCountColB)
Else
MyString = MyString & "," & Range("C" & RowCountColB)
End If
End If
RowCountColB = RowCountColB + 1
Loop
RowCountColA = RowCountColA + 1
Range("D" & RowCountColD) = MyString
RowCountColD = RowCountColD + 1

Loop

End Sub


"jbjtc" wrote:

Hie, can anyone help with the following:
COL A COL B COL C COL D
Unit 1 Unit 1 3B Unit 1: 3B, 5LH, 6RH
Unit 2 Unit 1 5LH Unit 2: 4B, 6LH, 7RH
Unit 3 Unit 1 6RH Unit 3: 5B, 4LH, 9RH
Unit 4 Unit 2 4B Unit 4
Unit 2 6LH
Unit 2 7RH
Unit 3 5B
Unit 3 4LH
Unit 3 9RH
Unit 4

What i've got are 4 unique units, each of which have a handing assigned to
them.
I need to concatenate the info in each column against each unique unit,
which gives the info on one row for each unit (COL D).
This is just an example. I may have unique units which have no handing info
against them (e.g. Unit 4) and therefore will appear on there own in COL D
with no handing info against them etc.

A macro to automate this process would be greatly appreciated.
Thanks
--
jj

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Concatenate info from columns into rows

Thanx Joel
It works a treat
--
jj


"Joel" wrote:

Sub combinerows()

RowCountColA = 1
RowCountColD = 1
Do While Range("A" & RowCountColA) < ""
UnitNo = Range("A" & RowCountColA)
RowCountColB = 1
CombinedString = UnitNo & ": "
MyString = CombinedString
Do While Range("B" & RowCountColB) < ""
If Range("B" & RowCountColB) = UnitNo Then
'need to see if init string so a comma can be added
If MyString = CombinedString Then
MyString = MyString & Range("C" & RowCountColB)
Else
MyString = MyString & "," & Range("C" & RowCountColB)
End If
End If
RowCountColB = RowCountColB + 1
Loop
RowCountColA = RowCountColA + 1
Range("D" & RowCountColD) = MyString
RowCountColD = RowCountColD + 1

Loop

End Sub


"jbjtc" wrote:

Hie, can anyone help with the following:
COL A COL B COL C COL D
Unit 1 Unit 1 3B Unit 1: 3B, 5LH, 6RH
Unit 2 Unit 1 5LH Unit 2: 4B, 6LH, 7RH
Unit 3 Unit 1 6RH Unit 3: 5B, 4LH, 9RH
Unit 4 Unit 2 4B Unit 4
Unit 2 6LH
Unit 2 7RH
Unit 3 5B
Unit 3 4LH
Unit 3 9RH
Unit 4

What i've got are 4 unique units, each of which have a handing assigned to
them.
I need to concatenate the info in each column against each unique unit,
which gives the info on one row for each unit (COL D).
This is just an example. I may have unique units which have no handing info
against them (e.g. Unit 4) and therefore will appear on there own in COL D
with no handing info against them etc.

A macro to automate this process would be greatly appreciated.
Thanks
--
jj

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate multiple rows and columns into 1 cell mj44 Excel Discussion (Misc queries) 21 July 19th 07 09:18 AM
Columns A - BY and 336 rows.Too much to filter&sort?Lose info. greenlawn06 Excel Worksheet Functions 1 May 16th 06 09:40 PM
Columns A - BY and 336 rows.Too much to filter&sort?Lose info. greenlawn06 Excel Worksheet Functions 2 May 16th 06 07:17 PM
Numbering rows in A1 only no matter info in other columns. Pamela New Users to Excel 3 May 2nd 06 09:29 PM
Rearrange info in rows to columns - HELP! LaVerne Excel Discussion (Misc queries) 0 June 20th 05 09:40 PM


All times are GMT +1. The time now is 03:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"