Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Rearranging text data.

I currently receive a file that has a list of client ID and each Client ID
contants a list of codes listed on the same row of the Client ID. I need to
have the codes modified so that they show up under a column instead on the
same row.


EX: the data comes to me in this format
Column
A D E
F G
JACK AA AB AC AD
JOEY AA AG AC AL
JAMES AD CD ED DE

I need the data to come out in this format:

JACK AA
JACK AB
JACK AC
JACK AD
JOEY AA
JOEY AG
JOEY AC
JOEY AL


Etc.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Rearranging text data.

This small macro assumes the source data is on Sheet1 and the reorganized
data will be placed on Sheet2:

Sub ReOrganizer()
Dim s1 As Worksheet, s2 As Worksheet
Dim nRows As Long, nCols As Long, k As Long
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
nRows = Cells(Rows.Count, "A").End(xlUp).Row
k = 1
For i = 1 To nRows
v1 = Cells(i, 1).Value
nCols = Cells(i, Columns.Count).End(xlToLeft).Column
For j = 2 To nCols
v2 = Cells(i, j).Value
s2.Cells(k, 1).Value = v1
s2.Cells(k, 2).Value = v2
k = k + 1
Next
Next
End Sub

--
Gary''s Student - gsnu200857


"Houston123" wrote:

I currently receive a file that has a list of client ID and each Client ID
contants a list of codes listed on the same row of the Client ID. I need to
have the codes modified so that they show up under a column instead on the
same row.


EX: the data comes to me in this format
Column
A D E
F G
JACK AA AB AC AD
JOEY AA AG AC AL
JAMES AD CD ED DE

I need the data to come out in this format:

JACK AA
JACK AB
JACK AC
JACK AD
JOEY AA
JOEY AG
JOEY AC
JOEY AL


Etc.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Rearranging text data.

I'm currently getting Compile Error / Syntax Error.
v1 = Cells(i, 1) .Value

Workbook is named "Worksheet"
Worksheet 1 is "Sheet1"
Worksheet 2 is "Sheet2"

Client ID Data located on Column A, Row 1,2,3,4 ETC.
Codes data located on Column B, C, D, E, F ETC.



"Gary''s Student" wrote:

This small macro assumes the source data is on Sheet1 and the reorganized
data will be placed on Sheet2:

Sub ReOrganizer()
Dim s1 As Worksheet, s2 As Worksheet
Dim nRows As Long, nCols As Long, k As Long
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
nRows = Cells(Rows.Count, "A").End(xlUp).Row
k = 1
For i = 1 To nRows
v1 = Cells(i, 1).Value
nCols = Cells(i, Columns.Count).End(xlToLeft).Column
For j = 2 To nCols
v2 = Cells(i, j).Value
s2.Cells(k, 1).Value = v1
s2.Cells(k, 2).Value = v2
k = k + 1
Next
Next
End Sub

--
Gary''s Student - gsnu200857


"Houston123" wrote:

I currently receive a file that has a list of client ID and each Client ID
contants a list of codes listed on the same row of the Client ID. I need to
have the codes modified so that they show up under a column instead on the
same row.


EX: the data comes to me in this format
Column
A D E
F G
JACK AA AB AC AD
JOEY AA AG AC AL
JAMES AD CD ED DE

I need the data to come out in this format:

JACK AA
JACK AB
JACK AC
JACK AD
JOEY AA
JOEY AG
JOEY AC
JOEY AL


Etc.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Rearranging text data.

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Houston123" wrote in message
...
I'm currently getting Compile Error / Syntax Error.
v1 = Cells(i, 1) .Value

Workbook is named "Worksheet"
Worksheet 1 is "Sheet1"
Worksheet 2 is "Sheet2"

Client ID Data located on Column A, Row 1,2,3,4 ETC.
Codes data located on Column B, C, D, E, F ETC.



"Gary''s Student" wrote:

This small macro assumes the source data is on Sheet1 and the reorganized
data will be placed on Sheet2:

Sub ReOrganizer()
Dim s1 As Worksheet, s2 As Worksheet
Dim nRows As Long, nCols As Long, k As Long
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
nRows = Cells(Rows.Count, "A").End(xlUp).Row
k = 1
For i = 1 To nRows
v1 = Cells(i, 1).Value
nCols = Cells(i, Columns.Count).End(xlToLeft).Column
For j = 2 To nCols
v2 = Cells(i, j).Value
s2.Cells(k, 1).Value = v1
s2.Cells(k, 2).Value = v2
k = k + 1
Next
Next
End Sub

--
Gary''s Student - gsnu200857


"Houston123" wrote:

I currently receive a file that has a list of client ID and each Client
ID
contants a list of codes listed on the same row of the Client ID. I
need to
have the codes modified so that they show up under a column instead on
the
same row.


EX: the data comes to me in this format
Column
A D E
F G
JACK AA AB AC AD
JOEY AA AG AC AL
JAMES AD CD ED DE

I need the data to come out in this format:

JACK AA
JACK AB
JACK AC
JACK AD
JOEY AA
JOEY AG
JOEY AC
JOEY AL


Etc.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Rearranging text data.

OP sent file which was NOT as advertised. It was using cols e:?? and
formulas to get the split. So, just easier to do TTC and then line em up.
This will do no matter how many codes.

Option Explicit
Sub DoTextToColumns() 'SalesAidSoftware
Application.DisplayAlerts = False
Cells(2, 3).Resize(Cells(Rows.Count, 1).End(xlUp).Row - 1). _
TextToColumns Destination:=Range("E2"), _
DataType:=xlDelimited,Comma:=True
Application.DisplayAlerts = True
End Sub

Sub ReOrganizerDon() 'SalesAidSoftware
DoTextToColumns

Dim ss, do As Worksheet
Dim i, lc, i, dlr As Long
Set ss = Sheets("Current Data")
Set ds = Sheets("Processed Data")
ds.Columns(1).Resize(, 2).Clear

For i = 2 To ss.Cells(Rows.Count, 1).End(xlUp).Row

lc = ss.Cells(i, Columns.Count).End(xlToLeft).Column
For j = 5 To lc
dlr = ds.Cells(Rows.Count, 1).End(xlUp).Row + 1
ds.Cells(dlr, 1) = ss.Cells(i, 1)
ds.Cells(dlr, 2) = ss.Cells(i, j)
Next j

Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
If desired, send your file to my address below along with this msg
and a clear explanation of what you want and before/after examples.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Houston123" wrote in message
...
I'm currently getting Compile Error / Syntax Error.
v1 = Cells(i, 1) .Value

Workbook is named "Worksheet"
Worksheet 1 is "Sheet1"
Worksheet 2 is "Sheet2"

Client ID Data located on Column A, Row 1,2,3,4 ETC.
Codes data located on Column B, C, D, E, F ETC.



"Gary''s Student" wrote:

This small macro assumes the source data is on Sheet1 and the
reorganized
data will be placed on Sheet2:

Sub ReOrganizer()
Dim s1 As Worksheet, s2 As Worksheet
Dim nRows As Long, nCols As Long, k As Long
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
nRows = Cells(Rows.Count, "A").End(xlUp).Row
k = 1
For i = 1 To nRows
v1 = Cells(i, 1).Value
nCols = Cells(i, Columns.Count).End(xlToLeft).Column
For j = 2 To nCols
v2 = Cells(i, j).Value
s2.Cells(k, 1).Value = v1
s2.Cells(k, 2).Value = v2
k = k + 1
Next
Next
End Sub

--
Gary''s Student - gsnu200857


"Houston123" wrote:

I currently receive a file that has a list of client ID and each
Client ID
contants a list of codes listed on the same row of the Client ID. I
need to
have the codes modified so that they show up under a column instead on
the
same row.


EX: the data comes to me in this format
Column
A D E
F G
JACK AA AB AC AD
JOEY AA AG AC AL
JAMES AD CD ED DE

I need the data to come out in this format:

JACK AA
JACK AB
JACK AC
JACK AD
JOEY AA
JOEY AG
JOEY AC
JOEY AL


Etc.



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
Rearranging data RA Excel Discussion (Misc queries) 3 June 5th 09 07:11 PM
Rearranging DATA raj74 Excel Discussion (Misc queries) 6 April 12th 09 12:11 PM
Rearranging data Witold Excel Discussion (Misc queries) 6 May 15th 07 02:54 PM
Rearranging text falcios Excel Discussion (Misc queries) 13 February 11th 07 11:22 PM
Rearranging Data Help... Jambruins Excel Discussion (Misc queries) 0 February 22nd 05 03:31 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"