You are here:

Excel/Find records with differing secondary column

Advertisement


Question
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?

Thanks!

Answer
Hi Steve,

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

In a new column, say J enter:
=A2&B2
Then in K:
=COUNTIF($H$2:$H$100,H2)
and in L:
=COUNTIF($J$2:$J$100,J2)

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

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jan Karel Pieterse

Expertise

Excel and Excel/VBA questions

Experience

Excel MVP

Organizations
Self employed Excel developer

Education/Credentials
Bachelor in Chemical Engineering

Awards and Honors
Microsoft MVP award since 2002

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

©2016 About.com. All rights reserved.