#1   Report Post  
hamster
 
Posts: n/a
Default Need to Concatenate


Hi All,

I go an excel with data in this format (3 columns):

LAST_NAME FIRST_NAME Selections
Adcock Julia Do
Adcock Julia Ra
Adcock Julia Me
Aiple Matthew Do
Aiple Matthew Ra

I want to concatenate the third column like this for each person (to
the existing sheet above)

LAST_NAME FIRST_NAME Selections
Adcock Julia Do, Ra, Me
Aiple Matthew Do, Ra


I know that this is done by conditional formating - but I have never
used this before. Would anyone have any ideas? Is this a difficult task
to do in excel?

Thanks,
James.


--
hamster
------------------------------------------------------------------------
hamster's Profile: http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Need to Concatenate

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim sTemp
Dim rng As Range
Dim iStart As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
sTemp = Range("A2").Value & Range("B2").Value
iStart = 2
For i = 3 To iLastRow
If Cells(i, "A").Value & Cells(i, "B").Value = sTemp Then
Cells(iStart, "C").Value = Cells(iStart, "C").Value & _
", " & Cells(i, "C").Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
Else
sTemp = Cells(i, "A").Value & Cells(i, "B").Value
iStart = i
End If
Next i

If Not rng Is Nothing Then
rng.Delete
Set rng = Nothing
End If


End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"hamster" wrote in
message ...

Hi All,

I go an excel with data in this format (3 columns):

LAST_NAME FIRST_NAME Selections
Adcock Julia Do
Adcock Julia Ra
Adcock Julia Me
Aiple Matthew Do
Aiple Matthew Ra

I want to concatenate the third column like this for each person (to
the existing sheet above)

LAST_NAME FIRST_NAME Selections
Adcock Julia Do, Ra, Me
Aiple Matthew Do, Ra


I know that this is done by conditional formating - but I have never
used this before. Would anyone have any ideas? Is this a difficult task
to do in excel?

Thanks,
James.


--
hamster
------------------------------------------------------------------------
hamster's Profile:

http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903



  #3   Report Post  
hamster
 
Posts: n/a
Default Need to Concatenate


Wow that was fast!

How I can I this Format- Conditional Formatting in Excel?

Thanks and again much appreciated.
James.


--
hamster
------------------------------------------------------------------------
hamster's Profile: http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default Need to Concatenate

Format|conditional formatting won't help you in this case.

If you look at the output, you'll see the Bob actually changed your data by
combining it nicely.

hamster wrote:

Wow that was fast!

How I can I this Format- Conditional Formatting in Excel?

Thanks and again much appreciated.
James.

--
hamster
------------------------------------------------------------------------
hamster's Profile: http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903


--

Dave Peterson
  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default Need to Concatenate

Sorry, I should have mentioned that you can't do that with CF, and I gave
you some code that does it instead.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob Phillips" wrote in message
...
Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim sTemp
Dim rng As Range
Dim iStart As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
sTemp = Range("A2").Value & Range("B2").Value
iStart = 2
For i = 3 To iLastRow
If Cells(i, "A").Value & Cells(i, "B").Value = sTemp Then
Cells(iStart, "C").Value = Cells(iStart, "C").Value & _
", " & Cells(i, "C").Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
Else
sTemp = Cells(i, "A").Value & Cells(i, "B").Value
iStart = i
End If
Next i

If Not rng Is Nothing Then
rng.Delete
Set rng = Nothing
End If


End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"hamster" wrote in
message ...

Hi All,

I go an excel with data in this format (3 columns):

LAST_NAME FIRST_NAME Selections
Adcock Julia Do
Adcock Julia Ra
Adcock Julia Me
Aiple Matthew Do
Aiple Matthew Ra

I want to concatenate the third column like this for each person (to
the existing sheet above)

LAST_NAME FIRST_NAME Selections
Adcock Julia Do, Ra, Me
Aiple Matthew Do, Ra


I know that this is done by conditional formating - but I have never
used this before. Would anyone have any ideas? Is this a difficult task
to do in excel?

Thanks,
James.


--
hamster
------------------------------------------------------------------------
hamster's Profile:

http://www.excelforum.com/member.php...o&userid=28706
View this thread:

http://www.excelforum.com/showthread...hreadid=483903







  #6   Report Post  
hamster
 
Posts: n/a
Default Need to Concatenate


Thanks Phil! This really helps since I was going to have code this. This
will save a lot of time for similar queries....

Only problem is the first line doesn't work out... but we changed it
slightly to this... what do you think?

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim sTemp
Dim rng As Range
Dim iStart As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
sTemp = Range("A1").Value & Range("B1").Value
iStart = 1
For i = 2 To iLastRow
If Cells(i, "A").Value & Cells(i, "B").Value = sTemp Then
Cells(iStart, "C").Value = Cells(iStart, "C").Value & _
", " & Cells(i, "C").Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
Else
sTemp = Cells(i, "A").Value & Cells(i, "B").Value
iStart = i
End If
Next i

If Not rng Is Nothing Then
rng.Delete
Set rng = Nothing
End If


End Sub


--
hamster
------------------------------------------------------------------------
hamster's Profile: http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903

  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default Need to Concatenate

Changed, in what way?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"hamster" wrote in
message ...

Thanks Phil! This really helps since I was going to have code this. This
will save a lot of time for similar queries....

Only problem is the first line doesn't work out... but we changed it
slightly to this... what do you think?

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim sTemp
Dim rng As Range
Dim iStart As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
sTemp = Range("A1").Value & Range("B1").Value
iStart = 1
For i = 2 To iLastRow
If Cells(i, "A").Value & Cells(i, "B").Value = sTemp Then
Cells(iStart, "C").Value = Cells(iStart, "C").Value & _
", " & Cells(i, "C").Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
Else
sTemp = Cells(i, "A").Value & Cells(i, "B").Value
iStart = i
End If
Next i

If Not rng Is Nothing Then
rng.Delete
Set rng = Nothing
End If


End Sub


--
hamster
------------------------------------------------------------------------
hamster's Profile:

http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903



  #8   Report Post  
hamster
 
Posts: n/a
Default Need to Concatenate


Sorry Philip,

To make myself more clear I changed the following lines:

sTemp = Range("A1").Value & Range("B1").Value -- was A2
iStart = 1
-- Was 2
For i = 2 To iLastRow
-- Was 3

The number you start with here determine the row it starts the
formula?
ie, the values here assume the data starts on the first line?

Either way, this has been a massive help and thank you! :)


--
hamster
------------------------------------------------------------------------
hamster's Profile: http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903

  #9   Report Post  
Bob Phillips
 
Posts: n/a
Default Need to Concatenate

I did that to avoid the headings row being included in the re-organisation.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"hamster" wrote in
message ...

Sorry Philip,

To make myself more clear I changed the following lines:

sTemp = Range("A1").Value & Range("B1").Value -- was A2
iStart = 1
-- Was 2
For i = 2 To iLastRow
-- Was 3

The number you start with here determine the row it starts the
formula?
ie, the values here assume the data starts on the first line?

Either way, this has been a massive help and thank you! :)


--
hamster
------------------------------------------------------------------------
hamster's Profile:

http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903



  #10   Report Post  
hamster
 
Posts: n/a
Default Need to Concatenate


Gotcha - Thanks. I hope to get some free time to study some of these
tricks in more details. That's an eye opener! Thanks!


--
hamster
------------------------------------------------------------------------
hamster's Profile: http://www.excelforum.com/member.php...o&userid=28706
View this thread: http://www.excelforum.com/showthread...hreadid=483903

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
How to concatenate adjacent cells in a range without using &? Ark Excel Worksheet Functions 4 October 16th 05 06:38 PM
Concatenate Jeff Excel Discussion (Misc queries) 4 October 5th 05 04:39 PM
Using Concatenate inside a vlookup bmclean Excel Worksheet Functions 3 July 5th 05 09:29 PM
space between text strings with concatenate Jeff Excel Discussion (Misc queries) 2 March 3rd 05 06:54 PM
Concatenate cells without specifying/writing cell address individually Hari Excel Discussion (Misc queries) 4 January 3rd 05 06:05 PM


All times are GMT +1. The time now is 10:14 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"