How to Rank Candidates by Votes in Microsoft Access
Question details
Rank candidate records by vote total, with the highest totals receiving the best rank.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A candidate list contains a Votes Garnered field that needs to be ranked in a query.
- Observed behavior
- Microsoft Access does not provide a native RANK function for query results.
Identify the candidate table and confirm that Votes Garnered is a numeric field. The example excludes records with null vote totals; enter zero for candidates with no votes if they should be ranked.
Rank vote totals with a correlated subquery
Use an Access SQL query to give the highest vote total rank 1 and assign the same rank to ties.
The subquery counts records with a higher vote total than the current record, then adds 1. Tied records receive the same rank, and the next rank has a gap: for example, 1, 1, 3.
In Access, select Create > Query Design, then switch to View > SQL View.
Enter: SELECT T.*, 1 + (SELECT Count(*) FROM Candidates AS D WHERE D.[Votes Garnered] > T.[Votes Garnered]) AS VoteRank FROM Candidates AS T WHERE T.[Votes Garnered] Is Not Null ORDER BY T.[Votes Garnered] DESC;
Replace both occurrences of Candidates with your actual table name. Enclose the name in square brackets if it contains spaces, and update [Votes Garnered] if your field has a different name.
Select Run to display the records in descending vote order with their VoteRank values.

Review exported candidate results in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format compatibility for an easy transition. Export Access results to Excel to review them in WPS Spreadsheets; WPS does not run Access database queries.

Frequently Asked Questions
Why do tied candidates have the same rank?
The subquery counts only records with a strictly greater vote total. Candidates with equal totals therefore have the same number of records ahead of them and receive the same rank.
Why are there gaps in the ranks after a tie?
The query uses competition ranking: if two candidates are tied at rank 1, the next candidate is rank 3 because two records have higher vote totals.
How do I rank the lowest vote total first?
In SQL View, change the subquery comparison from > to < and change ORDER BY T.[Votes Garnered] DESC to ORDER BY T.[Votes Garnered] ASC.
What happens to candidates with no vote total entered?
The example excludes null values using WHERE T.[Votes Garnered] Is Not Null. Enter 0 in the table for candidates who should be included with no votes.
Can I open the results in WPS Office?
Run the query in Access and use External Data > Excel to export its results. You can then open the exported Excel file in WPS Spreadsheets; WPS does not execute the Access query.




