SPREADSHEET PROBLEM

Please post any questions regarding the program here.

Moderator: 2020vision

SPREADSHEET PROBLEM

Postby BERTRAND » Sun Aug 07, 2011 12:11 pm

Hi
I need to insert blank rows in between 10,000 races. (Betfair historical data). I can use the Date/Time column for this but otherwise I can't figure it out. Any help would be greatly appreciated.
Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby osknows » Mon Aug 08, 2011 8:26 am

If your intending to insert a blank row between each existing row. Then run a for/next loop backwards and insert. Pseudo code would look something like

For i = 1000 to 1 step -1
'insert row
next i


If you intend to add a fixed block of empty rows. Eg say you want to add 500 empty rows between rows 999 and 1000 of 10,000 rows. Do the following

1. number rows 1 - 999: 1 - 999
2. number rows 1000 - 10,000: 1501 - 10,501
3. number blank rows 10,001 - 10,500: 1000 - 1500
4. Sort
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby BERTRAND » Mon Aug 08, 2011 10:04 am

I just want to separate all the races from each other. A space between (blank row) each race. Each race has one row per runner in that race. So I will end up with 10,000 blocks of data, each seperated by a blank row above and below.
When the "time of the race" changes in the "time of race" column then that will be the start of the next race, so I need to insert a blank row in between the two races. IF(A2<>A1 then insert blank row.
Hope this is not too confusing!
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby osknows » Mon Aug 08, 2011 10:46 am

Try this

Code: Select all
Sub InsertRows()
Application.Calculation = xlCalculationManual
    With Sheet1 'change to required Sheet Codename
   
    For i = 10000 To 2 Step -1
        If .Range("A" & i).Value <> .Range("A" & i - 1).Value Then
            .Rows(i).Insert Shift:=xlDown
        End If
    Next i
   
    End With
Application.Calculation = xlCalculationAutomatic
End Sub
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby BERTRAND » Mon Aug 08, 2011 11:40 am

Many thanks Os
This will give me a chance to see if I can use VB with "Open Office". If not I can convert the sheet to Excel. My version of Excel is ancient (XP OFFICE). It's positively archaic compared to Open Office. But once the code has done the job then I can convert back again!

When using your code, do I need to put anything in a module?
Cheers
Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby BERTRAND » Wed Aug 10, 2011 11:12 am

Hi Os
Your code did the job.
I promise I won't ask for any more code after this next request. I will be studying VB.
I now have my blocks of data seperated by blank rows. I would like to "RANK" the SP column for each individual block(Race). The results of this function going in a new column unsorted.
Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby osknows » Wed Aug 10, 2011 12:13 pm

Hi Bert,

The formulae in these 2 threads will contain what you need somewhere. You'll have to adapt them to suit whatever columns you are using

http://www.gruss-software.co.uk/forum/v ... highlight=

http://www.gruss-software.co.uk/forum/v ... highlight=
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby BERTRAND » Sat Aug 13, 2011 2:01 am

Thanks Os
Expert.
Taught me a lot figuring it out.
If anybody else want's to use it I would make sure the initial ROW references are the same ie H2,A2,$A$2:

=RANK(H2,INDIRECT(ADDRESS(MATCH(A2,$A$1:$A$65000,0),8,1)&":"&ADDRESS(MATCH(A2,$A$1:$A$65000,0)+COUNTIF($A$1:$A$65000,A2)-1,8,1)),1)
Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby osknows » Sat Aug 13, 2011 10:28 am

or to make it easier

=RANK(H2,INDIRECT(ADDRESS(MATCH(A2,$A$1:$A$65000,0),8,1)&":"&ADDRESS(MATCH(A2,$A$1:$A$65000,0)+COUNTIF($A$1:$A$65000,A2)-1,8,1)),1)

A2,$A$1:$A$65000 column A contains the race name groupings

H - column H contains the data to rank

8 - is also column H but expressed as a column number
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am


Return to Help

Who is online

Users browsing this forum: No registered users and 45 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.