Help

Find the highest 5 values

Topic Labels: Formulas
619 2
cancel
Showing results for 
Search instead for 
Did you mean: 
elifuyar
4 - Data Explorer
4 - Data Explorer

Hello everyone. I am new to the Airtable world and I have a question that I would like your help with. 

I have 17 number fields. They are called A, B, C, D, E ...

I want to have 5 fields called max1, max2, max3, max4 and max5. Max1 field is going to be the highest value of those 17 fields. Max2 is going to be second highest value of 17 fields and so on till max5. (They don't have to be unique.)

I could find the highest value with the formula MAX(A,B,C,D,...) but couldn't find any info on how to find the other max values.

Example:

ABCDEFGMAX1MAX2MAX3
01.316.8503.45.38.58.56.855.3
16.27.22.3004.47.26.24.4

I am not even sure if it is possible to do what I'm asking. But I hope I can get some guidance.

2 Replies 2

Identifying the top 5 values out of 17 values would be really difficult with formulas. I’ve written some really complex formulas, and while I might try to find the top two or three with formulas, I wouldn’t both to find the top five because things get crazy complicated.

I’m guessing that you come from a spreadsheet background versus a database background, so my suggestion might seem weird to you.

I would take a different approach and move all the scores to a second linked table with a new row for each score. So each row in your main table would have 17 linked records. This secondary table would have four fields: a linked record field to the main table, a numeric field for the score, an text field for the label the score is associated with, and a numeric ranking field. This numeric ranking field would need to be entered manually, calculated with a script, or calculated using an extension. The highest score would have a rank of 1, etc.

Then back in the main table, have conditional rollup fields that roll up the score based on the ranking. For example, the Max1 field would rollup the score field where the score field has a rank of 1.

What you want to do with the top five scores might also have an impact on how to build the system. For example, if you only need to find the sum of the top scores and not the individual scores, you would need fewer rollups. Sorting the linked record field also opens up variations on this method. 

Will this work if I have hundreds of records?