# Use the Rank and Percentile Tool from the Analysis ToolPak in Excel 2007 and Excel 2010 to create ranking tables

Updated on May 2, 2013 ## Introduction

Welcome to my latest hub looking into the tools available in the Analysis ToolPak which is part of both Excel 2007 and Excel 2010. In this hub, I will be investigating the Rank and Percentile Tool.

Ranking allows you to rank all your data in order from highest to lowest and Percentile allows you to easily categorise your data into percentiles such as the top 25%, top 50% etc.

To illustrate how to use this tool, I will work through an example. In my example, I have a class of 30 students. I have just got their latest results and want to rank them and assign them grades based on their ranking within the class. The top 10% get an A, the next 20% get a B, the next 20% get a C and the remainder get a D grade.

My ultimate goal is to end up with a table such as the one shown below with as little manual work as possible: Ranking Table created using the Rank and Percentile Tool from the Analysis Toolpak in Excel 2007 and Excel 2010. | Source

In conjunction with the Rank and Percentile tool, I will use the MATCH and INDEX functions to assign the student names to the raw data created by the tool. I will then use the IF function to automatically assign a grade to them based on their result as well.

## Adding the Analysis ToolPak in Excel 2007 and Excel 2010

Before using the tool, we need to ensure that the Analysis ToolPak is present in Excel. The ToolPak can be found on the Data tab, in the Analysis group and is accessed via the Data Analysis button. I have a hub that covers adding both the Developer tab and the Analysis ToolPak to both Excel 2007 and Excel 2010 which can be found here:

http://robbiecwilson.hubpages.com/hub/Using-the-Analysis-ToolPak-in-Excel-2007-and-Excel-2010

## Using the Rank and Percentile Tool in Excel 2007 and Excel 2010

Now that we have added the Analysis ToolPak, select the Data Analysis button and select Rank and Percentile as shown below. Selecting the Rank and Percentile Tool in the Analysis ToolPak using Excel 2007 and Excel 2010. | Source

The tool itself it quite straightforward and easy to use:

• First select the Input Range
• If your data is in columns, leave Grouped By as Columns (otherwise select Rows)
• If you have labels for your columns, then select Labels in first row
• Lastly, select your Output options, select Output Range to place it in a specific place on your worksheet or select New Worksheet Ply or New Workbook depending on your preference (we placed the tool’s results next to the original data in the example we are working through today)
• Click OK and Excel will create your Rank and Percentile table Output of the Rank and Percentile Tool, created using the Rank and Percentile Tool from the Analysis Toolpak in Excel 2007 and Excel 2010. | Source

You can see the output above from the tool. Excel has ranked every student and given them their exact percentile (the Percent column), however, rather than using the students names, there is a column called Point, which is the row number of each student. To turn the Point column into a column containing the student’s name, I need to turn to the MATCH and INDEX function.

## Using the MATCH and INDEX function in Excel 2007 and Excel 2010 to convert the results in the Point Column created by the Rank and Percentile Tool to the actual

These two functions work in tandem to convert the results in the Point column to the student’s name.

First:

• The MATCH function looks for the number in the Point column and then finds its exact match in the column labelled Student No.
• INDEX then looks for the cell adjacent to the result that MATCH found and returns the student’s name.

In the figure below, you can see the formula that turns 12 in the Point column to our top student (Ed Bradley) The MATCH and INDEX function matching the results with the student's name in Excel 2007 and Excel 2010. | Source

The entire formula is

=INDEX(\$B\$3:\$B\$32,MATCH(F5,\$A\$3:\$A\$32))

It is easier to understand broken down into its component parts, MATCH and INDEX

• The MATCH function looks for the contents of F5 (12) in the range A3 to A32

MATCH(F5,\$A\$3:\$A\$32))

• The INDEX function then looks in the range B3 to B32 for the cell adjacent to the cell found by MATCH

So, MATCH finds 12 in cell A14 and INDEX finds Ed Bradley in the cell adjacent to A14

Note: the \$’s added to the cell references tells Excel 2007 and Excel 2010 that these cell references do not change even when the formula is copied to other cells (known as absolute cell references). This prevents Excel from adding one to each cell reference each time you copy it (the formula would become =INDEX(B4:B33,MATCH(F4,A4:A33)) rather than =INDEX(\$B\$3:\$B\$32,MATCH(F4,\$A\$3:\$A\$32)) which may otherwise provide a potentially incorrect result).

I placed this formula in the column to the right of the Point column to make it easier to complete our final table with the column header of Student.

I have a hub that looks at both the MATCH and INDEX functions in far more detail, this time to create Top Ten lists which can be found here:

http://robbiecwilson.hubpages.com/hub/Using-the-MIN-and-MAX-SMALL-and-LARGE-INDEX-and-MATCH-functions-in-Excel-2007

## Completing our table ranking our students in Excel 2007 and Excel 2010

Now that we have a column containing our students names, to complete the table:

• Hide the Point and Rank columns (do not delete them or the formulas will break)
• Copy the Percent column and place it to the right of the original column
• Change the name of the original Percent column to Grade

Remember that we wanted to do this as automatically as possible. To assign our students a grade, we will use an IF statement as shown below: Using an IF statement to assign student's a grade in Excel 2007 and Excel 2010. | Source

=IF(K3<50%, "D", IF(K3>90%, "A", IF(K3>70%,"B", IF(K3>50%, "C"))))

This formula looks at the Percent column and looks at the percent and then assigns a letter based on the result it finds.

Note: The order is vitally important, if we did it in the order C, B, A then we would end up with only D and C grades as Excel would look at all numbers above 50% and give them a C and the formula would end.

• Copy this formula to the remainder of the Grade column.

Now we have our completed table, which looks like the figure below: Completed ranking table created using the Rank and Percentile Tool, MATCH, INDEX and IF functions in Excel 2007 and Excel 2010. | Source

## Conclusion

The Rank and Percentile Tool from the Analysis ToolPak which is available in Excel 2007 and Excel 2010 allows us to work with data and rank it and then have Excel calculate its percentile.

In my example today, I took my (fictional) class of students and ranked them according to their test results. I then gave them a grade depending on where they sat ranked against their peers.

To accomplish this, I not only used the Rank and Percentile Tool, I also used the MATCH and INDEX functions to convert the results so that the name of the student appeared next to their grade, and then also used the IF command to automatically assign them their grade.

This hub is part of a series of hubs investigating the tools available in the Analysis ToolPak. The other tools I have looked at in greater depth include: Example of a Histogram, created using the Histogram Tool from the Analysis Toolpak in Excel 2007 and Excel 2010. | Source Example of a Moving Average, created using the Moving Average Tool from the Analysis Toolpak in Excel 2007 and Excel 2010. | Source Example of a table showing daily variations, created using the Sampling Tool from the Analysis Toolpak in Excel 2007 and Excel 2010. | Source Example of a Regression, created using the Regression Tool from the Analysis Toolpak in Excel 2007 and Excel 2010. Example of a Correlation, created using the Correlation Tool from the Analysis Toolpak in Excel 2007 and Excel 2010.

Histogram: this tool allows us to look at the distribution of your data in graphical form. You can configure the boundary values the histogram uses to, for example, look at student exam data and chart the grade distribution across their results.

http://robbiecwilson.hubpages.com/hub/Using-the-Histogram-Tool-from-the-Analysis-ToolPak-in-Excel-2007-and-Excel-2010

Moving Average allows you to analyse your data for trends and chart your data and any trend line created by the tool should a trend be present. In my hub on this tool, I looked at my historic web traffic and whether there was a trend in that data.

http://robbiecwilson.hubpages.com/hub/Using-the-Moving-Average-Tool-from-the-Excel-2007-and-Excel-2010-Analysis-ToolPak

Sampling creates a random sample from a larger population you can analyse. I created lottery numbers from a pool in my example.

http://robbiecwilson.hubpages.com/hub/Use-the-Sampling-Tool-in-the-Excel-2007-and-Excel-2010-Analysis-ToolPak-for-sampling-and-to-analyse-periodic-variations

Regression and Correlation allow you to look at the relationship between variables. Correlation allows you to test the relationship between variables and Regression allows you to visually display this using a linear regression. In the hub on correlation, I investigate the relationship between daily temperatures and pie sales and in the hub on regression, fish mortality and Phosphate and Nitrogen concentrations in water.

http://robbiecwilson.hubpages.com/hub/Using-the-Correlation-Tool-from-the-Excel-2007-and-Excel-2010-Analysis-ToolPak

http://robbiecwilson.hubpages.com/hub/Using-the-Regression-Tool-from-the-Analysis-ToolPak-in-Excel-2007-and-Excel-2010

I do hope that you have found this hub both useful and informational. If you have any comments, please feel free to leave them below.

See results