Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Compiling a List of Students in a Course.

Compiling a List of Students in a Course

Written by Allen Wyatt (last updated February 15, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


Keval has a table of over 5,000 students distributed across 22 courses of study. Against each student's name in each row of this table is indicated the course in which the student is registered. Keval would like, on a different worksheet, to put a course name in cell A1 and then have Excel display, beginning in row 3, all the students in that course, as pulled from the list. He wonders if there is a way to do this with a formula.

The best solution to this problem is going to be dependent, in large part, on how your source data is organized. If you only have two columns (student name and course name), then it is possible that you don't even need to use a second worksheet. Instead, you can get by using Excel's filtering capabilities. Just filter on the contents of the column that contains the course name, and you can easily limit what is displayed to only those students in the course.

If you must have the information appear on the second worksheet, it may be best to use an array formula to extract the students. Put the desired course in cell A1 and then the following formula in cell A3:

=IF(COUNTIF(Sheet1!$B$1:$B$5000,$A$1)<ROW()-2,"",
INDEX(Sheet1!$A$1:$A$5000,SMALL(IF(Sheet1!$B$1:$B$5000=$A$1,
ROW(Sheet1!$B$1:$B$5000)),ROW()-2)))

Remember—this is a single formula and you need to enter it in the cell by pressing Ctrl+Shift+Enter. Copy the formula downward into enough cells that it should accommodate your largest class. The formula also assumes that the source data in in rows 1 through 5000; if this is not the case, you'll want to modify the formula to reflect the appropriate range.

Another approach is to create a PivotTable based upon the student/course list. All you need to do is make sure that both the course name and the student name fields are in the "row" area of the PivotTable. Put the course name field first and the student name field second, and you'll end up with a list of all courses with the students under each course name.

If your source data has additional information associated with it (such as grades, addresses, book assignments, etc.), then you may want to consider working with an actual database program, such as Access. You'll be able to manipulate and extract data using tools that are superior to those in Excel.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12346) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Compiling a List of Students in a Course.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Getting Rid of Modify Style Message

When you apply styles to a paragraph, you may periodically see a message asking if you want to reapply the style or ...

Discover More

Adding a Border Around Text in a Chart

You can included text in your charts, and even place a border around the text.

Discover More

Stepping Through a Non-Contiguous Range of Cells

Using macros to step through each cell in a selection is a common occurrence. What if that selected range is made up of ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Determining a Name for a Week Number

You could use Excel to collect data that is useful in your business. For instance, you might use it to collect ...

Discover More

Ignoring N/A Values in a Sum

You can use some of Excel's worksheet functions across a range or worksheets, but not all of them. One that has problems ...

Discover More

Where Is that Text?

Looking for a formula that can return the address of a cell containing a text string? Look no further; the solution is in ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four minus 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.