I would use a macro:
Option Explicit
Sub testme()
Dim wks As Worksheet
Dim TopRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Set wks = Worksheets("Sheet1")
With wks
FirstRow = 1
TopRow = FirstRow
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For iRow = TopRow To LastRow
If Trim(.Cells(iRow, "A").Value) = "" Then
'empty cell in A, so concatenate it in column C
.Cells(TopRow, "C").Value _
= .Cells(TopRow, "C").Value & " " & .Cells(iRow, "B").Value
Else
'new group
TopRow = iRow
'put that value in column B into column C
.Cells(TopRow, "C").Value = .Cells(TopRow, "B").Value
End If
Next iRow
'uncomment this group (maybe!) when you've checked the output
'it deletes the rows where column A is empty
' On Error Resume Next
' .Range("A:A").Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
' On Error GoTo 0
End With
End Sub
If you're new to macros:
Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html
David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm
(General, Regular and Standard modules all describe the same thing.)
On 07/22/2010 04:35, Aioe wrote:
> Have the situation:
>
> col A col B
> 1 Peter xx1
> 2 xx2
> 3 Rea xx3
> 4 Don xx1
> 5 xx2
> 6 xx3
> 7 Pat
> 8 Ron zz1
> 9 xx4
> 12 xx5
> 13 yy1
> 14 yy2
> 15 aaa
> 16 bbb
>
> Can you help / explain which combination
> of functions to use to get concatenated,
> "xx1 xx2" in the cell C1 for Peter,
> "xx3" in the cell C3 for Rea,
> "xx1 xx2 xx3" in the cell C4 for Don,
> ..........................
> "zz1 xx4 xx5... bbb" in the cell C8 for Ron.
>
> thank you
>
>
--
Dave Peterson