How to calculate percentiles in Apple Numbers??

Hello people smarter than I,


I'm organizing some sports data and am looking to discover a formula I can apply to have Apple Numbers (4.3.1) calculate the percentile for each athlete given a list of source data.


For each athlete pictured below, I have information on Height, Wight and a variety of athletic tests (shuttle, three-cone, forty yard dash, vertical jump etc). I have set up the data with one column for the measurement and a place for the percentiles as it's neighbor.

User uploaded file

I'm simply wondering what I need to do in order to make each players measurement (let's say height) reference the total list of heights in order to understand where that specific player ranks in historical measurements of QB heights.


For example what would I need to do to find out where Danny Brannagan's (QB at top of list) height ranks as a percentile when calculated referencing every height in the list? Once I have that formula I can apply it to all the other tests I have measured and recorded (shuttle, three-cone, forty yard dash, vertical jump etc as mentioned earlier).


Thanks so much for your help!

iMac, macOS High Sierra (10.13.3)

Posted on Mar 6, 2018 4:40 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 7, 2018 2:21 AM

Hi Marsh,


The formula for calculating percentiles is PR% = L + ( 0.5 x S ) / N

Where L is the number of scores that are less than the subject score, S is the number of scores that are the same as the target score, and N is the total number of scores. rthe result is a fraction showing the portion of scores less than the current score (with an adjustment adding half the number of scores the same as the target score).


Translating this into a spreadsheet formula which will express the percentile as a whole number produces a tablelike the following:

User uploaded file

The formula in B2 of this table is:


B2: ((COUNTIF(A,"<"&A2)+0.5×COUNTIF(A,A2))÷COUNT(A))×100


The formula will return a result accurate to several decimal places—likely more precise than you require. I've formatted the cells in column B to display that value rounded to the nearest whole number, by setting the number of decimal places to 0.


Although the values in the table above are sorted, the formula does not require a sorted list.


Regards,

Barry

7 replies
Question marked as Top-ranking reply

Mar 7, 2018 2:21 AM in response to TSN_Marsh

Hi Marsh,


The formula for calculating percentiles is PR% = L + ( 0.5 x S ) / N

Where L is the number of scores that are less than the subject score, S is the number of scores that are the same as the target score, and N is the total number of scores. rthe result is a fraction showing the portion of scores less than the current score (with an adjustment adding half the number of scores the same as the target score).


Translating this into a spreadsheet formula which will express the percentile as a whole number produces a tablelike the following:

User uploaded file

The formula in B2 of this table is:


B2: ((COUNTIF(A,"<"&A2)+0.5×COUNTIF(A,A2))÷COUNT(A))×100


The formula will return a result accurate to several decimal places—likely more precise than you require. I've formatted the cells in column B to display that value rounded to the nearest whole number, by setting the number of decimal places to 0.


Although the values in the table above are sorted, the formula does not require a sorted list.


Regards,

Barry

Mar 7, 2018 4:14 PM in response to Yellowbox

Hi Ian,


Thanks for looking up the PERCENTILE function, which I had neglected to do.


Nice and simple in appearance, but at first glance it appears to be working in the direction opposite to what's needed here.


The percentile formula I've used accepts the numerical value and returns the position of that value in a sorted list as the percentage of all values in the list that are less than the chosen value (with an adjustment that includes half the values that are equal to the chose value as part of the 'lower than' group.


The PERCENTILE function accepts the Percentile value and the list of values, and calculates a value that would sit at that spot in the sorted list of values. Here are examples of both calculations, using the same list of values as I used above:

User uploaded file

The raw data in in column A of the table on the left.

Percentiles for each value are calculated in column B of that table, and displayed as the nearest whole number.

Because the maximum and minimum values in the set each occur twice, the formula assigns half of each to the collection of values 'below' that value. There are 19 values in the collection, so person is equivalent to about 5% of the population surveyed/tested, putting the lowest score (2) at the fifth percentile, and the highest at the 95th percentile.


The formula in B2 of this table is the one presented previously:

B2: ((COUNTIF(A,"<"&A2)+0.5×COUNTIF(A,A2))÷COUNT(A))×100


The table on the right uses the same data list.

The desired percentile values are listed in column A. Column B contains a formula that returns the value that would fit at that position, That actual value may not exist in the data list.


Values in column A are produced by this formula, entered in A2 and filled down to row 12:

A2: (12−ROW())×10


The score at each listed percentile are calculated by this formula, entered in B2 and filled down.


B2: PERCENTILE(Table 1::A,(12−ROW())÷10)


or this alternate formula:

B2: PERCENTILE(Table 1::A,A2/100


PERCENTILE might be useful in this case to set up a lookup table that would return percentiles from a limited list (such as the 10 in the table above (discounting the 0) for each height or weight figure in those columns.


Regards,

Barry

Mar 7, 2018 2:21 AM in response to Barry

Hey Barry,


Appreciate your response! As you can tell I'm really not used to working with formulas so I likely did this wrong but I tried to enter your formula as follows.

User uploaded file

and got the following

User uploaded file

While I obviously got the formula wrong I'm wondering if there might be a simpler formula that just tells the value in F2 to find its percentile within the total set of data in row E?


I also constantly sort the data so once I have the right formula plugged in for each given measurement will I need to preserve any column or row to not mess up the percentile of data being measured or will I be okay since the data will always just be referencing the entire column - in this case E.


I have marked your response as helpful and hope this is an easy fix I can apply to all spreadsheets as I have 1000's of data sets from players across the last two decades at a variety of positions and tests!

Mar 7, 2018 4:18 PM in response to Barry

Hey gang,


Appreciate your patience.


Below I applied the formula suggested and got back the following values ranging from 31.50 to 61.50 instead of from 0-100 as I was hoping.

User uploaded file

I then punched in all of the data on a percentile helper website and got back the following.

User uploaded file

How can I tweak the formula in the first picture above to give me the values seen in 'column F' of picture two which I did manually by copying and pasting each value into the percentile helper website?


Thanks!

Mar 7, 2018 4:49 PM in response to TSN_Marsh

Hi Marsh,


"I tried to enter your formula as follows."

User uploaded file

While there are parts of this that look like the formula I provided, there is a lot missing.


Here's how mine appears when copied from the formula editor and pasted as text:


B2: ((COUNTIF(A,"<"&A2)+0.5×COUNTIF(A,A2))÷COUNT(A))×100


In the formula editor, it looks like this:

User uploaded file

Note that yours is missing the two COUNTIF functions and the COUNT function, telling Numbers what to do with the parts contained in the parentheses following each function name. Here's a translation into 'people speak'


(

(

COUNTIF(A,"<"&A2) Count the values in column A that are less than the value in cell A2

+ Add

0.5*COUNTIF(A,A2) 0.5 multiplied by the count of the values in column A that are equal to the value in A2.

(Numbers will display * —the multiplication operator as × — the multiplication sign)

) Do everything from the bold ( to here. Use the result in the next step.

/ (displayed as ÷) Divide the result above by the result of:

COUNT(A) Count all the numbers in column A

) Complete the calculations above before the next step, using the result.

(The result will be a fraction between 0 and 1)

* 100 Multiply the result by 100 to convert the fraction to a number between 1 and 100


A in my formula is E in yours, displayed as Height.

A2 in my formula is E2 in yours.

My formula is placed in B2, and filled down that column.

Yours is placed in F2, and filled down that column.


When yours is working, you can click once on F2 to select that cell, then Copy (command-C).

Then select H2 and all cells in the column below it and Paste (command-V). The formula will automatically adjust to use values in column G.


To make the results display only two places after the decimal, select the cells in column F, open the Format Inspector, choose Cell, then set the pop-up menu to Number and the Decimal box to 2:

User uploaded file


Regards,

Barry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to calculate percentiles in Apple Numbers??

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.