Free £25 Bet!
Free £50 Bet at VCBet!
Free £25 Bet!

In association with Sports-Punter Free Bets Odds Comparison BetHelp Limso

We are the Official Forum of FreeBetting.net & FCBet.com


Sports News Sports Stats Live Scores OddsChecker Place Bets Suggest a Site


Go Back   The Punters Lounge - The World's Best Betting Forum > General Discussion > Tech & Gaming Forum

Tech & Gaming Forum This is the place for all your technical related questions about computers, programs or whatever...

UK & Irish Football Forum | Western European Football Forum | UEFA Cup & Champions League Football Forum | International Football Forum | Eastern & Southern European Football Forum | Nordic & Scandinavian Football Forum | Non European Football Forum | At The Races Forum | At The Races Systems Forum | Other Sports Forum | USA Sports Forum | Fantasy & Fun Comps Forum | Free Bets Forum | Systems & Strategy Forum | Glory Hunter's Forum | Tipster's Challenge Forum | Daily Racing Comp Forum | Euro & Worldwide Comp Forum | Poker Tourneys Forum | Poker Strategy Forum | Poker Chat Forum | Poker Live Forum | Poker Challenges Forum | Poker Staking Forum | e-Sport Poker League Forum | Bookmakers & Exchanges Forum | Punter's Tools/Betting Help Forum | General Chat Forum | Tech & Gaming Forum | Sports Banter Forum | Live Sports Feeds Forum

Reply
 
Thread Tools Display Modes
Old 14-01-2007, 01:45   #1 (permalink)
aka plopplop
 
Matthew's Avatar
 
Join Date: 08 Aug 2006
Location: Nottingham
Age: 29
Posts: 603
Default Excel (VBA) Assistance needed

21/10/2002InternationalIndoorCarpetQuarterfinals3Federer R.Roddick A.
07/01/2002InternationalOutdoorHardSemifinals3Federer R.Roddick A.
22/10/2001InternationalIndoorCarpetQuarterfinals3Federer R.Roddick A.


If I have the above data as a history for this match:

04/07/2003Grand SlamOutdoorGrassSemifinals5Federer R.Roddick A.


and I want to calculate the win % age for each player on the surface of the upcoming game.

My code currently counts the instances of the player names in the history data where the surface is the same.

You can see my problem, in the history data Federer has not player Roddick before the upcoming match. So I end up trying to do the calculation:

zero / zero

and i get an error.

"Run-time error '6':

Overflow"

I assume i need to change my code to cope with this.

The code as it stands is this:

player_1_h2h_surface_win_pct = (player1surfacecount / (player1surfacecount + player2surfacecount)) * 100

How do I change the code to cope with zero / zero?????

I could do On Error etc but I assume there must be a cleverer way.

Thanks in advance

Matt
Matthew is offline   Reply With Quote
Old 14-01-2007, 07:56   #2 (permalink)
Sabbatical punter
 
PAULM03's Avatar
 
Join Date: 27 Nov 2000
Age: 29
Posts: 10,246
Default Re: Excel (VBA) Assistance needed

I don't really use VBA but I have a bit of experience programming with matlab. The way I usually deal with that is to add the matlab 'epsilon' to the denominator. Epsilon is the limit of floating point precsion in matlab (10^-52, using double precision). I think there must be an equivalent in VBA. If not just add a really small number to your code manually, say 0.0000000000000001. This won't change the result within the limits of accuracy you're expecting and you shouldn't get a division by 0 error.
__________________

PAULM03 is offline   Reply With Quote
Old 14-01-2007, 08:40   #3 (permalink)
Pocket Rocket
 
mcgin's Avatar
 
Join Date: 06 Nov 2005
Posts: 924
Default Re: Excel (VBA) Assistance needed

Matt,

Only way to do other then On error os to have a check for the 0/0 condition using an if/else block. It's not very clean, but does exactly what you want

if ((player1surfacecount + player2surfacecount)=0)
player_1_h2h_surface_win_pct = 0 'Or whatever you want)
else
player_1_h2h_surface_win_pct = (player1surfacecount / (player1surfacecount + player2surfacecount)) * 100
mcgin is offline   Reply With Quote
Old 14-01-2007, 11:59   #4 (permalink)
aka plopplop
 
Matthew's Avatar
 
Join Date: 08 Aug 2006
Location: Nottingham
Age: 29
Posts: 603
Default Re: Excel (VBA) Assistance needed

PAULM03, mcgin,

Thanks very much - I went with mcgin's suggestion.

Like most things - simple solutions are the way forward.
My brain must have been a bit fuzzy at 2:45am.

Thanks again.
Matthew is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts



All times are GMT. The time now is 02:09.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

Free £100 Bet!
Online Bookmakers
Free £100 Bet!

Recommended Bookies: Bet365 | BetDirect | | Blue Square | Canbet | Centrebet | Coral | Eurobet | Ladbrokes | Paddy Power | Party Bets | Pinnacle Sports | Skybet | SportingBet | Stan James | ToteSport | VCBet

Recommended Betting Exchanges: | Betfair | WBX

Recommended for Spread Betting: Sporting Index |
Partner Sites
Football Betting Tips Free Bets Australian Free Bets HOT Odds Comparison Soccer Punter
Bookmakers Livescore SoccerVista Asian Handicap Betting Guide

Contact Us | Disclaimer


© 2008 PuntersLounge.Com Ltd | Gambling Problems?

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.