Identifying Duplicate Values in an Excel List, Part 2

In a previous article I explained how you can use Conditional Formatting in Excel 2007 and later to highlight duplicate values with just a couple of mouse-clicks. Although easy to implement, this technique identifies all instances of a duplicate value. A reader then asked how to format only the second and any subsequent instances. In this article I'll explain how, along with instructions on identifying duplicate values in Excel 2003 and earlier.

Figure 1: Conditional Formatting can identify the second and subsequent instances of duplicate values.

Let's say that we have a list of names, such as shown in Figure 1. Our goal is to highlight the second and any subsequent times that a name appears more than once on a list. To do so, we'll select the names, and then carry out these steps:

  • Excel 2007 and later: Choose Conditional Formatting from the Home tab, followed by New Rule, and then Use a Formula to Determine Which Cells to Format.
  • Excel 2003 and earlier: Choose Format, Conditional Formatting, and then change Cell Value Is to Formula Is.

In all versions of Excel, enter the following formula:

=COUNTIF($A$1:A1,A1)>1

Click the Format button, and then choose a color from the Fill tab in Excel 2007 and later, or the Patterns tab in Excel 2003 and earlier. Click OK twice to close the conditional formatting dialog boxes. Your resulting list should look like Figure 1.

In Excel 2003 you can use this formula to recreate the functionality discussed in my previous article:

=COUNTIF(A:A,A1)>1

With regard to the formulas, the COUNTIF function counts how many times an item appears in a given range. For the first formula, I'm using an expanding range anchored by $A$1. On subsequent rows A1 (without the dollar signs) becomes A2, A3, A4, and so on. This is how we're able to identify just the second instance and beyond because the formula will only return TRUE for the second instance and beyond.

For the second formula, I'm counting if an item appears more than once anywhere in the column. This means that all instances, including the first instance, of a duplicate item will be formatted with the color of your choice.

In the previous article, I describe how you can filter by color in Excel 2007 and later. Although this isn't possible in Excel 2003, you can place the COUNTIF functions shown above in a column adjacent to your data and then choose Data, Filter, and then AutoFilter to turn on the filtering arrows. Choose Custom from the drop-down arrow in the column that contains the COUNTIF formula you added, select Is Greater Than, enter 1, and then click OK.

About the author:

David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at david@acctadv.com or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link.

 

You may like these other stories...

No field likes its buzzwords more than technology, and one of today's leading terms is "the cloud." But it's not just a matter of knowing what's fashionable. Accounting professionals who know how to use...
There is a growing trend of accountants moving away from traditional compliance work to more advisory work. Client demand is there, but it is up to the accountants to capitalize on that. What should accountants' roles be...
 Event Date: April 24, 2014 In this session Excel expert David Ringstrom, CPA introduces you to a powerful but underutilized macro feature in Excel. David will introduce the Macro Recorder, which transforms actions...

Upcoming CPE Webinars

Apr 17
In this exciting presentation Excel expert David H. Ringstrom, CPA shares tricks that you can use with pivot tables every day. Remember, either you work Excel, or it works you!
Apr 22
Is everyone at your organization meeting your client service expectations? Let client service expert, Kristen Rampe, CPA help you establish a reputation of top-tier service in every facet of your firm during this one hour webinar.
Apr 24
In this session Excel expert David Ringstrom, CPA introduces you to a powerful but underutilized macro feature in Excel.
Apr 25
This material focuses on the principles of accounting for non-profit organizations' revenues. It will include discussions of revenue recognition for cash and non-cash contributions as well as other revenues commonly received by non-profit organizations.