**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: Counting Employees in Classes.

Beth was looking for a way to determine how many employees had taken at least ten classes that were offered at her company. She set up Excel so that column A (beginning at A2) contained employee names, and column B (beginning at B2) contained class names. When an employee took a class, their name was entered in column A, and the name of the class they took was placed in column B. Thus, column A would contain multiple instances of each employee's name, and column B would contain multiple instances of class names.

The question of how to determine when an employee had taken ten classes can best be answered by using the COUNTIF function. For instance, the following formula could be entered in each cell of column C:

=IF(COUNTIF(A:A,A2)>9,"10 classes or more","")

In order to use the formula correctly, this particular instance would be placed in cell C2 and then copied down in the rest of column C's cells. This causes the A2 reference in the formula to change so that it always references the cell two columns to its immediate left. (The formula in C2 references A2, the formula in C3 references A3, etc.)

Using this formula, when a particular person has taken their tenth class—meaning that their name appears in column A for the tenth time—then column C fills up with the phrase "10 classes or more" next to each class that particular person took. This is great, except when a bunch of different employees start crossing the ten-class threshold. Then column C starts to look cluttered.

To overcome the clutter, a variation on the above approach is to use the following formula in the cells of column C:

=IF(COUNTIF($A$2:A2,A2)>9,"10 classes or more","")

In this instance, the COUNTIF function doesn't look at every cell in column A; instead it looks at the cells in column A that are in rows less than or equal to the row in which the formula occurs. Thus, if this formula was in row 8, then COUNTIF would only look at rows 2 through 8 in doing its count. The result is that the phrase "10 classes or more" only appears in column C when a particular employee has passed the ten-class mark. It will not appear for instances where the employee was taking their first, second, third, and up to their ninth classes.

Finally, the employee class table can be made just a bit more fancy, and you can see exactly how many classes each employee has taken. If columns A and B still contain names and classes, you could place a single instance of each employee name in the first rows of column D, leaving column C blank. In column E you can place the following formula to the right of each employee name:

=COUNTIF(A:A,D2)

The result is that column E contains the number of instances of the name in column D that appears in column A. In other words, you have a count of how many classes each employee has taken. You could then use conditional formatting on the cells in column D so that they are shown in red if the count in column E is 10 or more.

*ExcelTips* is your source for cost-effective Microsoft Excel training.
This tip (2552) 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: **Counting Employees in Classes**.

**Professional Development Guidance!** Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out *Professional Excel Development* today!

Need to figure out if a value is outside of some arbitrary limit related to a different value? There are a number of ways you ...

Discover MoreDo you see some small rectangular boxes appearing in your formula results? It could be because Excel is substituting that box ...

Discover MoreReplacing one character in a text value with another character is easy. All you need to do is use the SUBSTITUTE function, as ...

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

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

Copyright © 2017 Sharon Parq Associates, Inc.

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