LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 747
Default Manipulating a matrix of data

This puts the transformed data in the 12th column (column L) and doesn't
supplant the existing data. Assumed therefore is that the range of numbers in
any row does not extend that far. Change to suit if they do. The code can of
course be changed to put the transformed data in a different worksheet etc.
Also assumed is that the data starts in cell A1 and ranges down an indefinite
number of rows. Change the cell reference to suit.

After generating the new data, you can check it for accuracy and paste it
over the existing data. The code also handles the situation where there are
no numbers following the letter. It will only return the letter in the
transformed data. If this can never happen then it could be simplified a
little.

Sub TransformData()
Dim r As Range
Dim i As Long, ii As Long
Dim x As Long, xx As Long

Set r = Range(Range("A1"), Range("A1").End(xlDown))
For i = 1 To r.Count
x = IIf(r(i, 2).Value = "", 2, Range(r(i), r(i).End(xlToRight)).Count)
For ii = 2 To x
xx = xx + 1
r(xx, 12).Value = r(i).Value & r(i, ii).Value
Next
Next
End Sub

Greg

"Magenta" wrote:

I am trying to change data from:

A 1 2 3
B 1 2
C 1 2 3 4

(presume that is 3 rows and 5 columns)

to

A 1
A 2
A 3
B 1
B 2
C 1
C 2
C 3
C 4

Can anyone help with formula, or hints on how to get there?

 
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
manipulating scanned data alaskachic Excel Discussion (Misc queries) 2 November 17th 06 09:13 PM
Manipulating Data Problem Jeff Excel Worksheet Functions 0 June 8th 06 04:28 AM
Training on Manipulating Data in Excel Rufus Excel Discussion (Misc queries) 1 October 18th 05 05:07 AM
subtotaling and manipulating a list of data TJN Excel Worksheet Functions 0 April 27th 05 11:17 PM
subtotaling and manipulating a list of data TJN Excel Worksheet Functions 0 April 27th 05 10:31 PM


All times are GMT +1. The time now is 10:08 AM.

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"