Help with converting D1 to time value when it's negative

Please post any questions regarding the program here.

Moderator: 2020vision

Help with converting D1 to time value when it's negative

Postby Captain Sensible » Tue May 15, 2007 9:05 pm

Ummm probably haven't explained to well in the title. The time before the off is sent to excel in the format 00:01:00 to cell (say) D1, after the race time has passed the figure is sent as -00:00:22 which excel seems to treat as text. Is there a way I can convert this figure back to a numerical value ? I've tried substituting the - out and a couple of other things but haven't managed it yet so thought best post on here rather than waste any more time


thanks
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby Mitch » Tue May 15, 2007 9:50 pm

Do you need to know how far past start time an event is, or just that it's past? (might be a stupid question but I'll ask anyway :D)

Are you wanting to do it with a worksheet formula or vba code?
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby Captain Sensible » Wed May 16, 2007 10:19 am

Need it to carry on counting really , I was just hoping to remove the minus sign and let it count upwards as it'd be ok for my code.

formula or vbs is fine, at the moment it kicks off some vba code


If Cells(1, 4) < 0.0223 Then


but stops when it goes to -00:00:01 which as we know most raves never go off to time. If i could get it counting upards after 00:00:00 that'd suit me fine as i could log say 3 minutes before the off and 3 mins after. It justs kicks off some code matching with the sportinglife site that I don't need to kick off continually.
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby GeorgeUK » Wed May 16, 2007 11:22 am

you could use =ABS(cell)

which returns the absolute value - without the sign
previously known as Gaseous (on the betfair forum)
User avatar
GeorgeUK
 
Posts: 315
Joined: Sat Nov 19, 2005 10:18 pm
Location: Scotland

Postby Captain Sensible » Wed May 16, 2007 1:30 pm

Thanks george, doesn't seem to work when i try it as the date is being sent to excel as text by BA and excel just throws up a value error
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby GeorgeUK » Wed May 16, 2007 2:40 pm

How about =DateValue(ABS(cell))
previously known as Gaseous (on the betfair forum)
User avatar
GeorgeUK
 
Posts: 315
Joined: Sat Nov 19, 2005 10:18 pm
Location: Scotland

Postby GeorgeUK » Wed May 16, 2007 2:43 pm

actually, i think that's backwards

convert text to date Datevalue(cell)
and use ABS on that to convert to absolute value

=ABS(Datevalue(cell))
previously known as Gaseous (on the betfair forum)
User avatar
GeorgeUK
 
Posts: 315
Joined: Sat Nov 19, 2005 10:18 pm
Location: Scotland

Postby Captain Sensible » Wed May 16, 2007 3:11 pm

Still threw up a value error George, I manage to sort it by scrabbling bits together

=TIMEVALUE(SUBSTITUTE(SUBSTITUTE(D11,CHAR(34),""),"-",""))

Probably some nice easy option out there but hey it works :)

Thanks for the help George wouldn't have been wiser with the time/date value thing if you hadn't helped so it saved me time
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby Captain Sensible » Wed May 16, 2007 3:19 pm

Grrr bloody thing threw up an error when the value wasn't negative so had to revise it to

=IF(ISERROR(TIMEVALUE(SUBSTITUTE(SUBSTITUTE(D11,CHAR(34),""),"-",""))),D11,TIMEVALUE(SUBSTITUTE(SUBSTITUTE(D11,CHAR(34),""),"-","")))
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby Mitch » Wed May 16, 2007 7:19 pm

You could use....

=IF(LEFT(D11,1)="-",TIMEVALUE(RIGHT(D11,8)),D11)

I think..... :? :shock:
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby Mitch » Wed May 16, 2007 7:21 pm

You could use....

=IF(LEFT(D11,1)="-",TIMEVALUE(RIGHT(D11,8 )),D11)

I think..... :? :shock:
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby Mitch » Wed May 16, 2007 7:21 pm

Posted again coz of the sunglasses smiley.
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby Captain Sensible » Wed May 16, 2007 7:56 pm

Thanks mitch, works and is much shorter than my efforts :(
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm


Return to Help

Who is online

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