Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
ah ah is offline
external usenet poster
 
Posts: 33
Default merging of data automatically

Hi;
I need someone's help urgently.

I've few columns of data as follows in my spreadsheet currently:

Employee Number Plan Enrolled
-------------------- ----------------
12345678 Benefit Plan
09876543 Benefit Plan
12345678 Social Security Plan

Currently, the data is being displayed in 2 rows as above. Please advice
whether I could make it to display as follows in stead:
Employee Number Plan Enrolled
-------------------- ----------------
12345678 Benefit Plan, Social Security Plan
09876543 Benefit Plan
  #2   Report Post  
Posted to microsoft.public.excel.misc
ah ah is offline
external usenet poster
 
Posts: 33
Default merging of data automatically

As a result of that, as long as the Employee Number repeats, I want Excel to
merge all the plan enrolled by this employee into 1 row. Please take note
that I've hundreds of employees in the spreadsheet now, thus I'm not be able
to do this manually. Can anyone please help?

"ah" wrote:

Hi;
I need someone's help urgently.

I've few columns of data as follows in my spreadsheet currently:

Employee Number Plan Enrolled
-------------------- ----------------
12345678 Benefit Plan
09876543 Benefit Plan
12345678 Social Security Plan

Currently, the data is being displayed in 2 rows as above. Please advice
whether I could make it to display as follows in stead:
Employee Number Plan Enrolled
-------------------- ----------------
12345678 Benefit Plan, Social Security Plan
09876543 Benefit Plan

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default merging of data automatically

You can use this macro against a copy of your worksheet--it destroys the
original while creating the new format.

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim LastRow As Long
Dim FirstRow As Long
Dim iRow As Long

Set wks = Worksheets("Sheet1")
With wks
With .Range("a:b")
.Cells.Sort key1:=.Columns(1), order1:=xlAscending, _
header:=xlYes
End With

FirstRow = 2
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value Then
.Cells(iRow - 1, "b").Value _
= .Cells(iRow - 1, "B").Value _
& ", " & .Cells(iRow, "B").Value
.Rows(iRow).Delete
End If
Next iRow
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


ah wrote:

Hi;
I need someone's help urgently.

I've few columns of data as follows in my spreadsheet currently:

Employee Number Plan Enrolled
-------------------- ----------------
12345678 Benefit Plan
09876543 Benefit Plan
12345678 Social Security Plan

Currently, the data is being displayed in 2 rows as above. Please advice
whether I could make it to display as follows in stead:
Employee Number Plan Enrolled
-------------------- ----------------
12345678 Benefit Plan, Social Security Plan
09876543 Benefit Plan


--

Dave Peterson
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
Merging multiple columns of data into one column of data Archangel Excel Discussion (Misc queries) 7 February 24th 07 10:02 AM
Merging data Vern Halen Excel Discussion (Misc queries) 1 October 3rd 06 06:34 PM
merging data bgamble77 New Users to Excel 3 June 1st 05 04:08 AM
Merging Data Ken Chace Excel Discussion (Misc queries) 1 April 7th 05 04:11 PM
Should Merging workbooks pick up new data or only edited data? Peggy L. Excel Worksheet Functions 0 January 13th 05 05:31 PM


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