You are here:

Excel/Find records with differing secondary column


Not really knowing VBA except how to adapt and modify other's code :-) I'm looking for the most efficient way of doing this.

Columns H and I together form a unique record. This means that if H = X and I = Y, everywhere X appears in H, Y should appear in I. An example:

H2 = "Apple"
I2 = "Pie"

Anywhere "Apple" appears in column H, column I should read "Pie" and not "Cake" or anything else.

Ok, so the problem is that there are exceptions to this rule in my spreadsheets, and I need to flag the value in column I with conditional formatting to isolate them for review. In my head I'm imagining that for each H, if the array of H&I returns multiple values anywhere throughout the spreadsheet, color C[1] purple. I just don't know how to go about it. Is there anything you can suggest?


Hi Steve,

Hope I understand what you need :-)
You could use formulas.

In a new column, say J enter:
Then in K:
and in L:

Column K now gives you a count for each value in column H.

Col. L gives the combined count of H and I.

When column K does not equal column L, there must be a more than one combination of H with I.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jan Karel Pieterse


Excel and Excel/VBA questions


Excel MVP

Self employed Excel developer

Bachelor in Chemical Engineering

Awards and Honors
Microsoft MVP award since 2002

Past/Present Clients
Shell, Fortis bank, ABN-AMRO bank, Morgan Stanley, ...

©2017 All rights reserved.