Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default organize the data--Help!

Hi, I'm assigned an task that to organize one file like this:

original table:
sn# ref# cir# ID#
4232 23 OT111000 F1000
4545 23 OT111000 F1001
8686 45 OT111000 F1002
8989 46 OT118989 F4230
7899 46 OT118989 F4231


the table wanted:
If Ref# and cir# are same, concatenate ID# together, like sample below:
sn# ref# cir# ID#
(any) 23 OT111000 F1000, F1001
8686 45 OT111000 F1002
(any) 46 OT118989 F4230, F4231

I like to run a macro to complete this because the table has tons of
records. Can anyone help me on this?

Any help would be greatly appreciated.

Sarah


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default organize the data--Help!

sg,
Copy your data to a new sheet and run this
Cecil

Option Explicit

Sub OrganizeData()
Dim LRow As Double
Dim i As Double

LRow = Range("B" & Rows.Count).End(xlUp).Row

Range("A1:D" & LRow).Sort Key1:=Range("B2"), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

For i = LRow To 2 Step -1
If Range("B" & i).Value = Range("B" & i - 1).Value Then
Range("D" & i - 1).Value = _
Range("D" & i - 1).Value & "," & Range("D" & i).Value
Range("B" & i).EntireRow.Delete
End If
Next i

End Sub

"sg" wrote in message
...
Hi, I'm assigned an task that to organize one file like this:

original table:
sn# ref# cir# ID#
4232 23 OT111000 F1000
4545 23 OT111000 F1001
8686 45 OT111000 F1002
8989 46 OT118989 F4230
7899 46 OT118989 F4231


the table wanted:
If Ref# and cir# are same, concatenate ID# together, like sample below:
sn# ref# cir# ID#
(any) 23 OT111000 F1000, F1001
8686 45 OT111000 F1002
(any) 46 OT118989 F4230, F4231

I like to run a macro to complete this because the table has tons of
records. Can anyone help me on this?

Any help would be greatly appreciated.

Sarah




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default organize the data--Help!

sg,
Copy your data to a new sheet and run this
Cecil

Option Explicit

Sub OrganizeData()
Dim LRow As Double
Dim i As Double

LRow = Range("B" & Rows.Count).End(xlUp).Row

Range("A1:D" & LRow).Sort Key1:=Range("B2"), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

For i = LRow To 2 Step -1
If Range("B" & i).Value = Range("B" & i - 1).Value Then
Range("D" & i - 1).Value = _
Range("D" & i - 1).Value & "," & Range("D" & i).Value
Range("B" & i).EntireRow.Delete
End If
Next i

End Sub

"sg" wrote in message
...
Hi, I'm assigned an task that to organize one file like this:

original table:
sn# ref# cir# ID#
4232 23 OT111000 F1000
4545 23 OT111000 F1001
8686 45 OT111000 F1002
8989 46 OT118989 F4230
7899 46 OT118989 F4231


the table wanted:
If Ref# and cir# are same, concatenate ID# together, like sample below:
sn# ref# cir# ID#
(any) 23 OT111000 F1000, F1001
8686 45 OT111000 F1002
(any) 46 OT118989 F4230, F4231

I like to run a macro to complete this because the table has tons of
records. Can anyone help me on this?

Any help would be greatly appreciated.

Sarah




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default organize the data--Help!

Thank you Cecil for your quick response, I definately will give a try. Sarah
"Cecilkumara Fernando" <cekufdo@sltnetDOTlk wrote in message
...
sg,
Copy your data to a new sheet and run this
Cecil

Option Explicit

Sub OrganizeData()
Dim LRow As Double
Dim i As Double

LRow = Range("B" & Rows.Count).End(xlUp).Row

Range("A1:D" & LRow).Sort Key1:=Range("B2"), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

For i = LRow To 2 Step -1
If Range("B" & i).Value = Range("B" & i - 1).Value Then
Range("D" & i - 1).Value = _
Range("D" & i - 1).Value & "," & Range("D" & i).Value
Range("B" & i).EntireRow.Delete
End If
Next i

End Sub

"sg" wrote in message
...
Hi, I'm assigned an task that to organize one file like this:

original table:
sn# ref# cir# ID#
4232 23 OT111000 F1000
4545 23 OT111000 F1001
8686 45 OT111000 F1002
8989 46 OT118989 F4230
7899 46 OT118989 F4231


the table wanted:
If Ref# and cir# are same, concatenate ID# together, like sample below:
sn# ref# cir# ID#
(any) 23 OT111000 F1000, F1001
8686 45 OT111000 F1002
(any) 46 OT118989 F4230, F4231

I like to run a macro to complete this because the table has tons of
records. Can anyone help me on this?

Any help would be greatly appreciated.

Sarah






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default organize the data--Help!

Hi Cecil,

Thanks for your help, it just works perfectly for me.
Sarah
"sg" wrote in message
...
Hi, I'm assigned an task that to organize one file like this:

original table:
sn# ref# cir# ID#
4232 23 OT111000 F1000
4545 23 OT111000 F1001
8686 45 OT111000 F1002
8989 46 OT118989 F4230
7899 46 OT118989 F4231


the table wanted:
If Ref# and cir# are same, concatenate ID# together, like sample below:
sn# ref# cir# ID#
(any) 23 OT111000 F1000, F1001
8686 45 OT111000 F1002
(any) 46 OT118989 F4230, F4231

I like to run a macro to complete this because the table has tons of
records. Can anyone help me on this?

Any help would be greatly appreciated.

Sarah




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 can I organize/transfer existing data into a new spreadsheet? PaddyR Excel Discussion (Misc queries) 1 November 13th 08 03:27 AM
re-organize data in fixed blocks anand Excel Worksheet Functions 4 April 13th 08 04:31 AM
How to organize data and use VLOOKUP nander Excel Discussion (Misc queries) 1 March 21st 06 11:29 PM
How to organize Data? Dave Peterson Excel Discussion (Misc queries) 1 March 21st 06 06:41 PM
organize data in a pivot table without summarizing? pivot table help Excel Worksheet Functions 0 December 2nd 05 01:33 AM


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