I have a calculated column displaying a numeric score ---is there a way to have this score rank ordered automatically? (example - scores would be 87, 75, 74...- where 87 would be the number 1 priority, 75 would be number 2...and so on--if you would change the priority it would automatically update the other priority numbers). Would this be another calculated column, javascript or workflow?


Calculated columns have no ability to look forwards or backwards to other rows so you wouldn't be able to calculate priorities with just that. There are a couple of other routes that can get you there.

Event Receiver

The easiest way I can think of to maintain a priority column would be with an Event Receiver that fires on item added, on item deleted, and on item changed. In the event receivers you would get all of the items in that list/library, sort them by score, then add the priority number.


If you're on Sharepoint 2013 or newer you could create a workflow (or Flow) that gets all the items from your list ordered by score, creates a variable "Priority" starting at 1, then loops through those items and sets Priority and increments Priority. You can set the workflow to run on create, edit, or delete. It takes quite a few steps to get that to work but it can be done.


You could achieve the result with javascript but that would be a bit trickier. The way I would do it is by adding PreSaveAction() to the new and edit forms that would retrieve all the items in the list and update the priority accordingly. The downside of this approach is that if any items are deleted or changed via datasheet/quick edit view, your priority numbers would be off.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.