Ranking in Access with PointsUpload ImagesLink Darrin Hebert 3 months ago
I have a potentially uncommon problem I'm trying to solve.
Overview: Imagine playing golf with a group of people with recurring tournaments. There is a scoring system that awards points based on how your score compares to others. I.E. 1st place awards 100 pts, 2nd 95, 3rd 90, and so on.
Problem: I have solved for ranking the scores. my challenge is on how to handle some limitations with players getting the same score and therefore getting the same rank. (I can deal with this as is) however, for the players that get the same score, I want to calculate how points are distributed amongst them.
Rules for distribution of points when ties occur: sum points for ranks 1,2,3... in this case 100+95+90=285, then evenly assign to each tying golfer... in this case that would give golfers 1,2,3 95 points each (285/3)... note that it is also possible for there to be other tying scores down the list (golfers 15 & 30 have a score of 40)
My SQL at this point: (which gives me a "#Error" in datasheet view (Adjustment field). I haven't gotten to the division part yet. Position=Rank
SELECT [MajorScoreOrderingQ P2].[WGT Name], [MajorScoreOrderingQ P2].Position, (DSum("[MajorPosPts]","[MajorPtSystem]","[MajorsPosition]=[" & [Position])) AS Adjustment FROM MajorPtSystem INNER JOIN [MajorScoreOrderingQ P2] ON MajorPtSystem.MajorsPosition = [MajorScoreOrderingQ P2].Position GROUP BY [MajorScoreOrderingQ P2].[WGT Name], [MajorScoreOrderingQ P2].Position ORDER BY [MajorScoreOrderingQ P2].Position;
any assistance is greatly appreciated and hopefully this doesn't constitute writing a book.
Scott Axton 3 months ago
The #Error usually is an indication that there isn't information in a field to be able to perform a calculation.
Hi Scott, thanks for the tip, however I believe my issue is different than assuming a zero (or some other value). While it may be true that the #Error suggests there isn't information in the Adjustment field, I'm trying to figure out why that may be. Because the underlying queries all return the results I'm looking for. I believe my issue may be in the use or the way I'm using DSum.
Is there anything I can share i.e. query results, table values, etc. that might aid in this troubleshooting?
Hi Alex, No [MajorsPosition]=[ is not a typo, it is the criteria for my DSum... specifically, I'm trying to add the points for the golfers that have the same 'Rank'.
Kevin Robertson 3 months ago
Alex is right. You have an extra bracket that isn't needed.
In MajorScoreOrderingQ P3: