Solved

Conditional formatting to highlight differences between two worksheets

Posted on 2013-06-16
8
660 Views
Last Modified: 2013-06-16
Hey guys,

I have been driving myself crazy trying to find the answer to this problem.

I have two contact lists, each in their own worksheet in an Excel 2010 workbook.

I need to find if any contact names in contact list B match those in contact list A. And if the name matches I need to check if the rest of their details are the same. If they dont match, I would like to use conditional formatting to highlight the cells that are different in contact list A.

I then also need to do the opposite, compare list A to B and highlight the unique contact names.

I spent a large part of yesterday trying to figure this out with no success. What I think I just figured out this morning was that using the VLOOKUP formula to return the matching text from the other worksheet, the conditional format doesn't seem to be able to recognise when the text matches and hence format the cell appropriately.

I would really appreciate any assistance that anyone may have. My brain turned to mush yesterday. Thanks.
0
Comment
Question by:defecta
  • 5
  • 3
8 Comments
 
LVL 80

Assisted Solution

by:byundt
byundt earned 500 total points
Comment Utility
Here are two Conditional Formatting formulas to consider. The first one highlights non-matching detail info in column B, while the second one highlights unique names.
=INDEX(Sheet1!B:B,MATCH($A1,Sheet1!$A:$A,0))<>B1
=COUNTIF(Sheet2!$A:$A,$A1)=0
0
 

Author Comment

by:defecta
Comment Utility
Thanks byundt.

I think I am applying the first formula incorrectly. Here is what I am trying to do.

I am applying that first conditional format formula to cell A1 on Sheet1.
I want it to find if A1 on Sheet 1 is unique in column C on Sheet2.
So the formula should look this?
=INDEX(Sheet2!C:C,MATCH($A1,Sheet1$A:$A,0))<>C1

(I dont understand how that B1 operates)

Thanks.
0
 

Author Comment

by:defecta
Comment Utility
I have the second formula working perfectly, thank you byundt.

I am still stuck with the first though.
0
 
LVL 80

Accepted Solution

by:
byundt earned 500 total points
Comment Utility
I've posted a sample file showing my suggested Conditional Formatting formulas in action.

My first Conditional Formatting formula was intended to be used on Sheet2. If you are using it on Sheet1, then it should be:
=INDEX(Sheet2!C:C,MATCH($A1,Sheet2$A:$A,0))<>C1

Brad
ConditionalFormattingQ28158812.xlsx
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Closing Comment

by:defecta
Comment Utility
That is excellent, Thank you so much byndt!

I think I can take it from here.
0
 

Author Comment

by:defecta
Comment Utility
One last query.

Can you explain what function the C1 has at the end of that formula?
0
 
LVL 80

Expert Comment

by:byundt
Comment Utility
=INDEX(Sheet2!C:C,MATCH($A1,Sheet2$A:$A,0))<>C1

In the above formula, MATCH is looking at Sheet2 column A and returning the index number (equivalent to a row number in this case) for where the value in Sheet1 cell A1 might be found.

The INDEX function then looks at Sheet2 column C on the same row, and returns a value.

The <>C1 part of the formula then compares the value from the INDEX to the contents of cell C1. If they are different (the <> part of the expression), then the formula returns TRUE. If they are the same, then the formula returns FALSE.

Conditional Formatting is expecting either a TRUE or FALSE value. If it gets anything other than TRUE, the Conditional Formatting doesn't occur. For example, if the MATCH fails (because the value in Sheet1 cell A1 isn't found in Sheet2 column A), the formula returns a #N/A error value--and Conditional Formatting doesn't occur. Only if there is a match in column A and the value in column C differs does the formula return TRUE--and the Conditional Formatting then highlights that cell.

I was careful to use $ in the formula so you could copy it down and across and the Conditional Formatting would be applied as required. The $ means to keep the reference to column A fixed, both for Sheet1 cell A1 and Sheet2 column A.

The references to row 1 and column C are relative. Assuming that they are correct for the top left cell in the range being Conditional Formatted, then those references will automatically adjust row number and column letter as required for all other cells that receive that formatting.

Brad
0
 

Author Comment

by:defecta
Comment Utility
Excellent explanation and my discovery this morning was leading me to that conclusion. That conditional formatting needs a true or false value. (I should have RTFM! LOL!)

Thanks again for a prompt and excellent explanation of how this all works.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now