View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Billy Liddel Billy Liddel is offline
external usenet poster
 
Posts: 527
Default Rearranging data

Witold

The only way I know is by macro. I think that your data is in two columns,
but it does not matter if it is in 1. However, its better to copy the data
before running the macro.

Copy the macro into the VB Editor, select the data and run the macro.

Sub CreateList()
' select Both columns
' make sure columns c .... z are blank
r = ActiveCell.Row - 1: col = ActiveCell.Column
nr = Selection.Rows.Count
For Each c In Selection
If IsEmpty(c) Then
'Do nothing
ElseIf IsNumeric(c) Then
col = 1: r = r + 1: Count = 1
Cells(r, col) = c
ElseIf Not IsNumeric(c) Then
Count = Count + 1
Cells(r, Count) = c
End If
Next
'remove data from remaining rows
Range(Cells(r + 1, 1), Cells(nr + 1, 2)).ClearContents
'remove selection
Range("A1").Select
End Sub

regards
Peter

"Witold" wrote:

Hi,

In short, currently my data looks like this:

A1 B1
2343
x234
x345
4567
x567
x678
x484
x444
3453
x564
x345
x543

etc.
While I would need it like this:

A1 B1 C1
2343 x234 1
x345 2
4567 x567 1
x678 2
x484 3
x444 4
3453 x564 1
x345 2
x543 3

I hope it's self explanatory and makes sense. Could somebody please
help me how to do this? I've got couple of thousands of these records,
everything is ready, it's a matter of one time conversion only.

Thank you.

--
Witold