Solved

How do I highlight a cell in Excel where the value is different to the cell five cells below it - and apply this to a whole row?

Posted on 2016-09-15
11
40 Views
Last Modified: 2016-09-17
I've been trying to get to grips with conditional formatting but I've not managed to get Excel to do what I want.

I have a row of data - row 2 - and I want to compare each value in row 2 with the data in the same column in in row 7.

If the data is different I want the cell to be highlighted in a colour.

I'm on Excel 2016.
0
Comment
Question by:purplesoup
  • 7
  • 4
11 Comments
 
LVL 25

Expert Comment

by:Shaun Kline
Comment Utility
Select the rows to which you want to apply conditional formatting.

Create a new conditional rule using the "Use a formula to determine cells to format" option.

In the "Format Values where this formula is true:", you can use a formula like:
=OR($A2<>$A7, $B2<>$B7....)
The comparison should be repeated for each column you want to compare.


Another option is to use:
= CONCATENATE($A2:$I2)<>CONCATENATE($A7:$I7)
($I should be your end column letter.)
1
 

Author Comment

by:purplesoup
Comment Utility
I tried the first option - which obviously takes along time to type in all the columns - I have about 100 - but it just highlights all the cells of both rows, even though I can see only about 3-4 are different.
0
 

Author Comment

by:purplesoup
Comment Utility
Second option does the same thing...
0
 

Author Comment

by:purplesoup
Comment Utility
What it is doing is highlighting the whole row if any values are different instead of just highlighting the cells that are different.
0
 
LVL 25

Expert Comment

by:Shaun Kline
Comment Utility
Thought you wanted to know which rows had different values. My mistake. To highlight just the cells with differences (cells in row 2 that are different than a cell in the same column 5 rows below it), use:

=AND($A7<>"", A2<>A7)

This formula assumes that column A will always have a value ($A7 <> ""), and prevents comparing a row against one that is completely blank. If that is not the case, and you do not have a column that will always have a value, let me know and I can provide a different formula.
1
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:purplesoup
Comment Utility
I may be missing something here. I highlighted A2 and A7 and entered the formula above - the values were different and it correctly highlighted both cells.

I then highlighted B2, C2 and D2, and B7, C7 and D7 and entered the following (none of them had blank values):

=AND($B2<>$B7, $C2<>$C7,$D2<>$D7)

Although all the values matched, it highlighted B2, C2 and D2.

I then highlighted B2 and B7 - as I said the values match - and entered this formula.

=AND($B7<>"", B2<>B7)

This worked - there is no highlighting.

I then highlighted C2, D2 and E2 and C7, D7 and E7 and entered the following formula:

=AND($C7<>"", C2<>C7,$D7<>"",D2<>D7,$E7<>"",E2<>E7)

Again, this highlighted C2, D2 and E2 even though the values matched.

So while I can see that this formula works if I apply it one cell at a time, I can't go through 100 of cells in a row and apply the formatting individually to each one. I need something which just says compare these two rows and highlight the cells that are different. Is this possible?
0
 

Author Comment

by:purplesoup
Comment Utility
Thank you for your suggestions by the way I don't mean to be rude.
0
 
LVL 25

Accepted Solution

by:
Shaun Kline earned 500 total points
Comment Utility
I'm listing the steps you need to follow to make this work. I believe you are missing the first step.

1.) Highlighting the entire area on your spreadsheet where you want to compare cells. If you are doing columns A to H and rows 2 to 20, then select the area from A2 to H20.
2.) Then select Conditional Formatting and then New Rule.
3.) Select "Use a formula to determine which cells to format".
4.) Enter the formula you want to use. In this case, try:
=AND($A7<>"", A2<>A7)
5.) Select your formatting.
6.) Click OK to exit the dialog box.

The use of the $ in the formula anchors that portion of the formula to column A, while the rest of the formula is not anchored. So if there is a difference between cells B2 & B7, the conditional formatting rule treats the formula as if it was =AND($A7<>"", B2<>B7).

Oh, and you are not being rude. Conditional formatting beyond some of the simple stuff can be very confusing until you work through it. Sometimes it helps to break out what you are attempting into small steps, and adding on more complex parts until you get the desired result.
1
 

Author Comment

by:purplesoup
Comment Utility
EXCELLENT!

Thank you for your patience - I've attached screenshots to show it working.

Thanks!
Step 1Step 2Step 3
0
 

Author Closing Comment

by:purplesoup
Comment Utility
I'm very happy :)
0
 
LVL 25

Expert Comment

by:Shaun Kline
Comment Utility
Glad to hear it worked and glad to help.
1

Featured Post

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

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

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

17 Experts available now in Live!

Get 1:1 Help Now