Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default need a macro to combine rows, columns

How do I go from this:
id name email zone 1 zone 2 zone 3
123 john dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit

To this:
id name email zone 1 zone 2 zone 3
123 john
dog cat
456 mary
cat
789 sue
dog cat rabbit

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default need a macro to combine rows, columns

Without a macro..........

DataFilterAdvanced Filter

Copy to another location.

Unique records only.


Gord Dibben MS Excel MVP

On Tue, 15 Sep 2009 12:46:01 -0700, mrsjcd3
wrote:

How do I go from this:
id name email zone 1 zone 2 zone 3
123 john dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit

To this:
id name email zone 1 zone 2 zone 3
123 john
dog cat
456 mary
cat
789 sue
dog cat rabbit

Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default need a macro to combine rows, columns

But that takes away the second or third rows that have different information
in the columns...

"Gord Dibben" wrote:

Without a macro..........

DataFilterAdvanced Filter

Copy to another location.

Unique records only.


Gord Dibben MS Excel MVP

On Tue, 15 Sep 2009 12:46:01 -0700, mrsjcd3
wrote:

How do I go from this:
id name email zone 1 zone 2 zone 3
123 john dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit

To this:
id name email zone 1 zone 2 zone 3
123 john
dog cat
456 mary
cat
789 sue
dog cat rabbit

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default need a macro to combine rows, columns

the advanced filter only hides those rows since they don't match the criteria.
By copying only the visible rows to a new sheet, your requirement is answered.
Seems your question may need to be re-phrased perhaps?

"mrsjcd3" wrote:

But that takes away the second or third rows that have different information
in the columns...

"Gord Dibben" wrote:

Without a macro..........

DataFilterAdvanced Filter

Copy to another location.

Unique records only.


Gord Dibben MS Excel MVP

On Tue, 15 Sep 2009 12:46:01 -0700, mrsjcd3
wrote:

How do I go from this:
id name email zone 1 zone 2 zone 3
123 john dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit

To this:
id name email zone 1 zone 2 zone 3
123 john
dog cat
456 mary
cat
789 sue
dog cat rabbit

Thanks!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default need a macro to combine rows, columns

What I need to do it to combine the different columnal information for the
same person which is currently in multiple rows, in to one row for that
person. I am not filtering, I am combining. I was hoping not to have to
cut, paste and delete 6000+ rows of data to condense it down to 3500 rows.
In my example, id # 123 has two rows, but each row has different columnal
information. I need to have all that data in one row. If I filter, I lose
the second or third row of information which I wanted to combine in to the
first row.
id name email zone 1 zone 2 zone 3
123 john dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit




"Patrick Molloy" wrote:

the advanced filter only hides those rows since they don't match the criteria.
By copying only the visible rows to a new sheet, your requirement is answered.
Seems your question may need to be re-phrased perhaps?

"mrsjcd3" wrote:

But that takes away the second or third rows that have different information
in the columns...

"Gord Dibben" wrote:

Without a macro..........

DataFilterAdvanced Filter

Copy to another location.

Unique records only.


Gord Dibben MS Excel MVP

On Tue, 15 Sep 2009 12:46:01 -0700, mrsjcd3
wrote:

How do I go from this:
id name email zone 1 zone 2 zone 3
123 john
dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit

To this:
id name email zone 1 zone 2 zone 3
123 john
dog cat
456 mary
cat
789 sue
dog cat rabbit

Thanks!




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default need a macro to combine rows, columns

Sub Main()
Dim col As Long
Dim thisrow As Long
Range("A1").CurrentRegion.Sort Range("A1")

For thisrow = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(thisrow, 1) = Cells(thisrow - 1, 1) Then
For col = 4 To Cells(thisrow, Columns.Count).End(xlToLeft).Column
Cells(thisrow - 1, Columns.Count).End(xlToLeft).Offset(, 1) = _

Cells(thisrow, col)
Next
Rows(thisrow).Delete
End If
Next



End Sub

"mrsjcd3" wrote:

What I need to do it to combine the different columnal information for the
same person which is currently in multiple rows, in to one row for that
person. I am not filtering, I am combining. I was hoping not to have to
cut, paste and delete 6000+ rows of data to condense it down to 3500 rows.
In my example, id # 123 has two rows, but each row has different columnal
information. I need to have all that data in one row. If I filter, I lose
the second or third row of information which I wanted to combine in to the
first row.
id name email zone 1 zone 2 zone 3
123 john dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit




"Patrick Molloy" wrote:

the advanced filter only hides those rows since they don't match the criteria.
By copying only the visible rows to a new sheet, your requirement is answered.
Seems your question may need to be re-phrased perhaps?

"mrsjcd3" wrote:

But that takes away the second or third rows that have different information
in the columns...

"Gord Dibben" wrote:

Without a macro..........

DataFilterAdvanced Filter

Copy to another location.

Unique records only.


Gord Dibben MS Excel MVP

On Tue, 15 Sep 2009 12:46:01 -0700, mrsjcd3
wrote:

How do I go from this:
id name email zone 1 zone 2 zone 3
123 john
dog
123 john
cat
456 mary
cat
789 sue
dog
789 sue
cat
789 sue
rabbit

To this:
id name email zone 1 zone 2 zone 3
123 john
dog cat
456 mary
cat
789 sue
dog cat rabbit

Thanks!


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
Not just remove dup rows but combine columns Colin Excel Worksheet Functions 1 January 14th 10 03:56 AM
Combine multiple columns and rows for one record into one row. Bowtie63 Excel Discussion (Misc queries) 2 February 16th 08 04:20 AM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 2 July 31st 06 09:45 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM
Combine the data in 2 columns of 20 rows into one column of 40 row Tom Excel Discussion (Misc queries) 6 May 3rd 06 09:27 AM


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