2 Replies Latest reply on Jun 17, 2011 2:31 PM by RP Missions

# How can I assign a rank to a series of variables?

I currently have an evaluation form that sums up responses for a group of workers, then I would like to assign a rank based upon the highest score and rank these thirteen values from 1 to 13. Is there a way to script this so that if:

Cal gets 500 pts

Bill gets 275 pts

Sue gets 505 pts

Bob gets150 pts

that the Script would assign

Cal with #2

Bill with #3

Sue with #1

Bob with #4

• ###### 1. Re: How can I assign a rank to a series of variables?

What should happen in the case of a tie between two or more scores? In any case, you can place the data (name/value) in an array and use the sort method of an array to sort in the order you want.

• ###### 2. Re: How can I assign a rank to a series of variables?

This sorting of 13 variables ultimately will be used to identify the lowest one that will be eliminated. This project uses an acrobat form completed by each member of a board. They submitted five essays, those essays are read by the rest of the board members and each essay is given a rank from 13 pts to 1 pts per essay. Then the acrobat form adds all five scores together to create a [BoardMemberTotalScore]. That sum total value is referenced again later in the document in my failed attempt to create generate a table with three columns:

First column was the board member's name; second column had their TotalScore, and third column was to be their ranking based upon their score (highest score gets a rank of 1 and lowest score becomes an alternate nominee for the upcoming election.

In the case of a tie, I may pick one of the essay scores as a tie breaker [BoardMemberQ1].

Then if I can get this to work, I would put another column out there that would give the user the ability to make the final judgement on ranking (letting the user determine how to go in the event of a tie(s).