excel help
 

MegaSack DRAW - This year's winner is user - rgwb
We will be in touch

[Closed] excel help

11 Posts
6 Users
0 Reactions
38 Views
 mrmo
Posts: 10710
Free Member
Topic starter
 

I have a spreadsheet within 900000 lines, it is Excel 2007 and it is a dump from SAP.

problem is that a large number of rows are junk and need to be deleted.

I have added a marker to every line that needs to be deleted, but the computer can't cope with a sort, i have written a macro that works its way through the file deleted every line, but it takes a long time.

It did dawn on me on the way home that the marker is an if statement. Would a copy paste to turn this into a value and not a formula speed things up much? Any other ideas of how to sort this in a way that will take less than a month!


 
Posted : 16/02/2011 8:18 pm
Posts: 13419
Full Member
 

IMPORT TO ms aCCESS, DELETE, EXPORT TO eXCEL

Without caps lock on


 
Posted : 16/02/2011 8:21 pm
Posts: 0
Free Member
 

hmm if excel won't sort try sticking in access?


 
Posted : 16/02/2011 8:21 pm
 mrmo
Posts: 10710
Free Member
Topic starter
 

was thinking the access route, just curious if there were any ways within excel. Will have to hope my new employer has put a copy of access on my PC.


 
Posted : 16/02/2011 8:23 pm
Posts: 0
Free Member
 

could try splitting it into say 4 worksheets, see if that helps sorting, then stick back together?


 
Posted : 16/02/2011 8:30 pm
Posts: 14792
Full Member
 

Can you filter on the column with the marker the delete the filtered rows?


 
Posted : 16/02/2011 8:35 pm
Posts: 79
Free Member
 

If you must use Excel, set calculations to manual and set application.screenupdating (or something like this) to false.


 
Posted : 16/02/2011 8:36 pm
Posts: 1781
Free Member
 

900,000 rows is a pretty unmanageable amount, but if you really want to do it in Excel the best way is a VBA procedure that creates an array of all the rows to be deleted and removes them all at the same time - much more efficient than individually.

Just so happens I've got a script written I can modify if you let me know some details e.g. what the marker is & where it appears.


 
Posted : 16/02/2011 10:03 pm
 mrmo
Posts: 10710
Free Member
Topic starter
 

thanks, the marker is wibble and is in column 8.


 
Posted : 16/02/2011 10:17 pm
Posts: 1781
Free Member
 

Give me a mo...


 
Posted : 16/02/2011 10:54 pm
Posts: 1781
Free Member
 

Here you go mrmo. Includes the option to add in other markers - NB these are case sensitive.

**********************************
Sub Remove_Unwanted_Rows()

Dim Cell As Object
Dim LastCell As Object
Dim DelRange As Range
Dim RowArray As Range

Set LastCell = Range("H1048576")
Set DelRange = Range(LastCell.End(xlUp), LastCell.End(xlUp).End(xlUp))

For Each Cell In DelRange
Select Case Cell.Value
Case Is = "wibble" ', "wubble", "wobble"
If RowArray Is Nothing Then
Set RowArray = Cell.EntireRow
Else
Set RowArray = Union(RowArray, Cell.EntireRow)
End If
End Select
Next Cell
RowArray.Delete
End Sub
**********************************


 
Posted : 16/02/2011 11:01 pm
Posts: 1781
Free Member
 

Hmmm... indenting removed itself - oh well


 
Posted : 16/02/2011 11:02 pm