View Single Post
  #2   Spotlight this post!  
Unread 03-02-2007, 01:15
kramarczyk's Avatar
kramarczyk kramarczyk is offline
is getting his kicks.
AKA: Mark Kramarczyk
FRC #3096 (Highlanders)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Sterling Heights, MI
Posts: 602
kramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond reputekramarczyk has a reputation beyond repute
Re: Help with VB code

The IF statements add up the totals of QP and RP's... since I kept with the original format of QP RP QP RP QP RP... I needed a way to seperate them out which is what the countif's do. The QP's just get added up so nothing else is required, but the RP's need to get averaged per section 9.3.8, not divided by 3.
Quote:
The total number of ranking points earned by a team throughout their qualification matches, divided by the number of matches played (excluding any SURROGATE matches), then truncated to two decimal places, will be their ranking score.
Since there is no automated 'average if' function I needed to build it... I used the sumif to add up the RP points and the count to see how many entries there are. However, since the QP and RP are listed in the same row I end up with a count of 6 for 3 matches, hence I divided the count by 2. sumif / count / 2. The ISERROR is just capturing any divide by zero errors that may occur because there are no entries for a team yet. The errors don't cause any harm, but they are ugly.

I'm not sure what the '/4 ' & '/3' tagged on the end of the suggested if statement do. Also, the formula in the iserror segment and the formula in the false section of the if should be the same for the error capturing to work as designed.

I acknowledge that the VB code could be cleaned up and made more elegent, but I was unable to follow the original code due to the lack of comments.

Mark