Cleaning up Data

C

caveman.savant

I have a messy txt file that should be cleaned up
http://spreadsheets.google.com/ccc?key=rAM3Bgm0m2g-563DPeygSKw

The 1st line is fairly simple to mid-string out what I need.
But what comes next is the hard part.
I would to take each cell and separate the "data"
Apr '09 0.0000 Jul '08 1.0000 Oct
'07 2.0000 Jan '07 0.0000 Yr 1 avg : 1.3333

This would mean
04/09 0
07/08 1
10/07 2
01/07 0
(the Yr 1 avg : 1.3333 is meaningless)

Then I would continue down to the next cell and do the same until I
reached the cell the is the "header"

Once I have this chunk of data converted I have to probably to a
column to row conversion and sort it into date order.
 
D

Don Guillett

I think I would develop a macro to do a text to columns>then cut every 2nd
row to the row above>then take blocks of three and make new rows>then>>>>
 
D

Don Guillett

Apr '09 0
Mar '09 0
Feb '09 7
Jan '09 1
Dec '08 4
Nov '08 0
Oct '08 0

Here is a macro using other developed macros to get this far

Sub dotexttocols()
Application.DisplayAlerts = False
Columns("A").TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, Space:=True
Columns("a").Delete
Columns.AutoFit
'do other macros
cutrows
copycolumns
delnonmonthrows
End Sub
Sub cutrows()
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If IsNumeric(Cells(i, 1)) Or _
Cells(i, 1) = "" Or _
Cells(i, 1) = "Month" Then Rows(i).Delete
Next i
End Sub
Sub copycolumns()
rlr = Cells(Rows.Count, 1).End(xlUp).Row
For i = 4 To 12 Step 3
lr = Cells(Rows.Count, 1).End(xlUp).Row + 1
'MsgBox Cells(1, i)
Cells(1, i).Resize(rlr, 3).Copy Cells(lr, 1)
Next i
End Sub
Sub delnonmonthrows()
lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 2 Step -1
If Len(Cells(i, 1)) <> 3 Then Rows(i).Delete
Next i
Columns(4).Resize(, 30).Delete
Rows.AutoFit
Columns.AutoFit
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top