separating distance

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

separating distance

Postby slochin » Wed Dec 02, 2015 12:13 pm

Hello,
I am hoping someone may be able to assist me please.
I am wanting to automatically select Aus horse races which are above a certain distance. Now the problem is that when I transfer the info from BA the distance is in the main heading line.

MVal (AUS) 4th Dec - 18:45 R1 1600m Mdn 23:20:00 Horse Racing\AUS\MVal (AUS) 4th Dec BFSP Y Parent id 27617849 Version 1.37E+08
This is all one line in Excel.

I was wondering if there was anyway to perhaps extract the distance from the line above and place it in a cell and then be able to tell excel not to carry out the usual betting procedure on the race as it comes up
if it is under the distance required.
Gil
slochin
 
Posts: 65
Joined: Sat Nov 28, 2015 1:20 am

Re: separating distance

Postby Captain Sensible » Wed Dec 02, 2015 2:18 pm

Are you sure that string is all in one cell? It's usually just something like Nort (AUS) 2nd Dec - 13:02 R7 297m FFA in cell A1.

Do you know how to use VBA and functions? If so you could just add the following code to a module and call it into any cell you want by just putting

Code: Select all
=findword(A1,8)


where A1 contains your cell and it'll just pick out the 8th word along then remove the "m" so you can use it for simple calculations.

Code: Select all
Function FindWord(Source As String, Position As Integer)
Dim arr() As String
arr = VBA.Split(Source, " ")
xCount = UBound(arr)
If xCount < 1 Or (Position - 1) > xCount Or Position < 0 Then
    FindWord = ""
Else
    FindWord = arr(Position - 1)
End If
FindWord = Replace(FindWord, "m", "")
End Function
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: separating distance

Postby slochin » Thu Dec 03, 2015 9:30 am

Hello Captain Sensible,
Not sure what's happening but have stopped receiving email advice that there is a new post.
On the bottom rung for VBA but am reading and watching info about it hoping to improve.
You are right about the race info being in ColA. Looking at a few of the races it would appear they follow the same format so selecting the 8th word would appear to be the exact thing I am looking for. This has made me more determined now to understand VBA.
As I stated in the original post I would like a way to be able to tell Betting Assistant if I do not want to bet on a race under a specified distance.
I thought by putting the distance of the race as it comes into the spreadsheet that I might be able to use a command to have Betting Assistant check the cell where the distance is and if it is under the required distance then no bets would be placed and so on for each race as it comes through.
Thanks again.
Gil
slochin
 
Posts: 65
Joined: Sat Nov 28, 2015 1:20 am

Re: separating distance

Postby Captain Sensible » Thu Dec 03, 2015 2:36 pm

VBA isn't as complicated as it first seems and does give you better control but can be a bt of a learning curve if you're not used to excel either.

Basically you open the workbook and press the ALT and F11 together to bring up the VBA editor screen, on the top menu select Insert and click module. On the left hand side of the screen you'll now see module attached to your worksheet, double click module and paste in the code

Code: Select all
Function FindWord(Source As String, Position As Integer)
Dim arr() As String

On Error GoTo ErrHandler:



arr = VBA.Split(Source, " ")
xCount = UBound(arr)
If xCount < 1 Or (Position - 1) > xCount Or Position < 0 Then
    FindWord = ""
Else
    FindWord = arr(Position - 1)
End If
FindWord = CInt(Replace(FindWord, "m", ""))
Exit Function
ErrHandler:
FindWord = 0
End Function


You've now added a new function to your spreadsheet, these functions are no different to the IF's , COUNT's AVERAGES etc that are already coded into excel they are just your own custom functions.

I amended the code slightly so it has error trapping if no distance is found it'll just return 0 as you want to bet over a specific distance rather than under, plus it'll return the value as a number so it can easily be used in any formulas.

Say you wanted it to say yes if it's over or equal to 1000 it'sas simple as putting the following in a formula

Code: Select all
=IF(findword(A1,8)>=1000,"YES","NO")


If you want to add it to existing code like on the other sheet you just include it within the AND statement like so

Code: Select all
=IF(AND(findword(A1,8)>=1000,R5<>"",F5>R5,$AA$1="Yes"),"BACK","")
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm


Return to Discussion

Who is online

Users browsing this forum: No registered users and 35 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.

cron