Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Combine Records; Difficult


Hello everyone! I have data in Columns A to G. I have a list of names in
Column B. If the names are arranged in descending order (so similar names
appear in above or below cells). If two names are the same, I'd like to take
the data in Column C, and combine the records, separated just by the pipe
character '|'. If the names in Column B are the same, all data in Column A,
as well as d to G will be the same. Only differences are in Column C. For
instance:
Befo
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 1/6/2009 ChiChi CA 94133
Ryan 142767 1/6/2009 ChiChi CA 94133
Ryan 142792 1/6/2009 ChiChi CA 94133

After:
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 | 142767 | 142792 1/6/2009 ChiChi CA
94133

How can it be done?
Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Combine Records; Difficult


for rw = range("C1").End(xldown).Row to 2 step -1
if cells(rw,"B").Value = Cells(rw-1,"B").Value then
Cells(rw-1,"C").Value = Cells(rw-1,"C").Value & " | " &
Cells(rw,"C").Value
rows(rw).Delete
end ifnext

"ryguy7272" wrote in message
...
Hello everyone! I have data in Columns A to G. I have a list of names in
Column B. If the names are arranged in descending order (so similar names
appear in above or below cells). If two names are the same, I'd like to
take
the data in Column C, and combine the records, separated just by the pipe
character '|'. If the names in Column B are the same, all data in Column
A,
as well as d to G will be the same. Only differences are in Column C.
For
instance:
Befo
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 1/6/2009 ChiChi CA 94133
Ryan 142767 1/6/2009 ChiChi CA 94133
Ryan 142792 1/6/2009 ChiChi CA 94133

After:
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 | 142767 | 142792 1/6/2009 ChiChi
CA
94133

How can it be done?
Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Combine Records; Difficult


Ryan, try this..

Sub Macro()
Dim lngRow As Long
For lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
If StrComp(Range("B" & lngRow), Range("B" & lngRow - 1), vbTextCompare) = 0
Then
If Range("C" & lngRow) < "" Then
Range("C" & lngRow - 1) = Range("C" & lngRow - 1) & "|" & Range("C" & lngRow)
End If
Rows(lngRow).Delete
End If
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

Hello everyone! I have data in Columns A to G. I have a list of names in
Column B. If the names are arranged in descending order (so similar names
appear in above or below cells). If two names are the same, I'd like to take
the data in Column C, and combine the records, separated just by the pipe
character '|'. If the names in Column B are the same, all data in Column A,
as well as d to G will be the same. Only differences are in Column C. For
instance:
Befo
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 1/6/2009 ChiChi CA 94133
Ryan 142767 1/6/2009 ChiChi CA 94133
Ryan 142792 1/6/2009 ChiChi CA 94133

After:
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 | 142767 | 142792 1/6/2009 ChiChi CA
94133

How can it be done?
Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Combine Records; Difficult


I works perfect Jacob! Thanks for the code and thanks super-fast response.
Ryan---

--

Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Jacob Skaria" wrote:

Ryan, try this..

Sub Macro()
Dim lngRow As Long
For lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
If StrComp(Range("B" & lngRow), Range("B" & lngRow - 1), vbTextCompare) = 0
Then
If Range("C" & lngRow) < "" Then
Range("C" & lngRow - 1) = Range("C" & lngRow - 1) & "|" & Range("C" & lngRow)
End If
Rows(lngRow).Delete
End If
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

Hello everyone! I have data in Columns A to G. I have a list of names in
Column B. If the names are arranged in descending order (so similar names
appear in above or below cells). If two names are the same, I'd like to take
the data in Column C, and combine the records, separated just by the pipe
character '|'. If the names in Column B are the same, all data in Column A,
as well as d to G will be the same. Only differences are in Column C. For
instance:
Befo
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 1/6/2009 ChiChi CA 94133
Ryan 142767 1/6/2009 ChiChi CA 94133
Ryan 142792 1/6/2009 ChiChi CA 94133

After:
Column A Column B Column C Column D Column E Column F Column G
Ryan 142726 | 142767 | 142792 1/6/2009 ChiChi CA
94133

How can it be done?
Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

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
Combine duplicate records in one row - In desperate need!!! ceci Excel Discussion (Misc queries) 2 February 4th 09 02:52 AM
How do I combine multiple records for a single item? DrStone98 Excel Discussion (Misc queries) 1 April 30th 07 11:22 PM
How to Combine Grouped Records onto one row Lynn H via OfficeKB.com Excel Programming 2 July 20th 05 01:54 PM
Combine several records into one [email protected] Excel Discussion (Misc queries) 3 March 15th 05 11:00 AM
combine two records No Name Excel Programming 0 September 23rd 04 02:29 PM


All times are GMT +1. The time now is 11:11 PM.

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"