Highlighting duplicate content of multiple rows across a set number of columns+rows

AssistanceIsFutile

New Member
Joined
Apr 5, 2013
Messages
4
I'm sorry if this question becomes wordy, however I'm having trouble identifying a way to communicate the problem I am trying to solve.

I am trying to find a way to highlight duplicate contents within a range of cells, however the "duplicate" condition depends on the results of three consecutive cells independent of the column. For illustrative purposes, here is an example table showing how my sheet looks (I'm sorry, I cannot install external applications at work so I hope this is sufficient).

Ex 1:
ABC
1A-IF-I
2A-IIF-II
3A-III
4A-IB-IC-I
5A-IIB-IIC-II
6A-IIIB-IIIC-III
7D-IE-IF-I
8D-IIE-IIF-II
9D-IIIE-IIIF-III

<tbody>
</tbody>

What you see in this table is two things, an area where data will be entered (A1:C3) and a pool of data (A4:C9). What I'm trying to do is create a formula that checks the pool of data against the entered data and highlights the cells in the pool if they match exactly. As you see in my example, A4:A6 matches A1:A3 so it is highlighted, but C7:C8 is not highlighted because it doesn't completely match B1:B3 (B3 is not yet entered).

The next two example tables shows progression of the sheet and how the conditional formatting should respond.

Ex 2 (although B1, B2, and C3 have exact matches, they are in different columns thus the individual matching cells do not get highlighted):
ABC
1A-IE-I
2A-IIE-II
3A-IIIF-IIIE-III
4A-IB-IC-I
5A-IIB-IIC-II
6A-IIIB-IIIC-III
7D-IE-IF-I
8D-IIE-IIF-II
9D-IIIE-IIIF-III

<tbody>
</tbody>

Ex 3 (C1:C3 have an exact match with B7:B9, so the duplicates are highlighted):
ABC
1A-IE-IE-I
2A-IIE-IIE-II
3A-IIIF-IIIE-III
4A-IB-IC-I
5A-IIB-IIC-II
6A-IIIB-IIIC-III
7D-IE-IF-I
8D-IIE-IIF-II
9D-IIIE-IIIF-III

<tbody>
</tbody>

The closest I've come with my tinkering is the conditional formatting formula "=COUNTIF($A$4:$C$9;A1:A3)>1" ... however this is insufficient because it highlights the individual duplicate cells, thus in example 2 all matches would be highlighted.

I hope my explanation and examples are clear enough. Any advice would be appreciated.

Edit: I'm using Excel 2010
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi and Welcome to the Board,

Since Conditional Formatting is volatile, consider using some helper cells to concatenate the combinations of 3 cells.

There might be a better way, but here is one combination of helper cells and CF formula that seems to work.

Paste the formula in E1 and copy across. Paste the formula in E4 and copy to range E4:G7.
Excel Workbook
ABCDEFG
1A-IF-IA-I|A-II|A-IIIF-I|F-II|||
2A-IIF-II
3A-III
4A-IB-IC-IA-I|A-II|A-IIIB-I|B-II|B-IIIC-I|C-II|C-III
5A-IIB-IIC-IIA-II|A-III|D-IB-II|B-III|E-IC-II|C-III|F-I
6A-IIIB-IIIC-IIIA-III|D-I|D-IIB-III|E-I|E-IIC-III|F-I|F-II
7D-IE-IF-ID-I|D-II|D-IIIE-I|E-II|E-IIIF-I|F-II|F-III
8D-IIE-IIF-II
9D-IIIE-IIIF-III
Sheet


Using these helper cells, try the CF formula:
=SUM(IF(E2:E4=$E$1:$G$1,1,0))
Applies to: =$A$4:$C$9
 
Upvote 0
Thank you for this response, it's a solution for what I'm looking for. However, I cannot seem to use the recommendation for a larger pool of data (or larger empty cells for Data Entry). Please see below:

Excel Workbook
ABCDEFG
1Data EntryHelper Cells for Data Entry
2A-ID-IA-I|A-II|A-IIID-I|D-II|D-III||
3A-IID-II
4A-IIID-III
5B-IB-I|B-II|B-III||||
6B-II
7B-III
8C-IC-I|C-II|C-III||||
9C-II
10C-III
11Data PoolHelper Cells for Data Pool
12A-IB-IC-IA-I|A-II|A-IIIB-I|B-II|B-IIIC-I|C-II|C-III
13A-IIB-IIC-II
14A-IIIB-IIIC-III
15D-IE-IF-ID-I|D-II|D-IIIE-I|E-II|E-IIIF-I|F-II|F-III
16D-IIE-IIF-II
17D-IIIE-IIIF-III
18G-IH-II-IG-I|G-II|G-IIIH-I|H-II|H-IIII-I|I-II|F-III
19G-IIH-III-II
20G-IIIH-IIIF-III
Sheet1



I tried with the following CF formula:
=SUM(IF(E3:E5=$E$2:$G$2;1;0))
Applies to: =$A$12:$C$20

You can see that the table is all sorts of messed up. A12:A14 is not highlighted despite matching A2:A4. B12:B14 and C12:C14 are highlighted correctly, however B15:B17, C15:C17, and strangely A19:A20 are highlighting despite the intended conditions not being met.

I assume it's in the conditions, perhaps perhaps I'm screwing up the formula when trying to adapt it to my actual sheet. Would you be able to advise a little bit about what your recommended formula is looking at? Hopefully this will help me understand how to apply it to my sheet of data.

Thanks for your help.
 
Upvote 0
I'm not sure I understand how the larger (9 row) Data Entry range is to be used.

My suggestion based on the Original Post took this approach (cell references to image in Post #2):
List every possible combination of 3 stacked Data Entries in a helper row list.
Only 3 cells are needed (E1:G1) to hold all the combinations for Data Entry Range A1:C3.

For the Data Pool, list every possible combination of 3 stacked Data Pool items in a 3 column by n Row table.
The combinations are formed using the same formula as (E1:G1) but they are only copied from Rows 4:7.
There is no need to copy to Rows 8:9, as these would just concatenate combinations of 2 and 1 item.
The formulas shouldn't be copied to Rows 2:3 because this would start to mix combinations of items from Data Entry and Data Pool ranges.

Once these helper values are in place, the Conditional Formatting Formula takes this approach:
For any cell "Me" in the Data Pool range, the cell should be highlighted if a match is found in (E1:G1) for one of these combinations:

Me & two cells below Me
cell above Me & Me & cell below me
two cells above Me & Me

Due to the placement of the helper cells, those 3 lookup combinations are located in the same relation to the cell "Me".
For cell "Me" = B6 the CF formula checks to see if any of the combinations in F4:F6 are found in E1:G1
For cell "Me" = A4 the CF formula checks to see if any of the combinations in E2:E4 are found in E1:G1, for values near the top and bottom of the Data Pool, there are less than 3 look up combinations. To keep the formula simple though, it still uses a 1 column by 3 row lookup, but some of those combinations cells are completely blank.

I believe the same concept could be applied to your larger data set. The increased number of rows in the Data Pool has no effect.
What isn't clear to me about the Data Entry Range is whether it represents 3 sets of 3-row combinations, or could any 3 row combinations be matched...
(cell references to image in Post #3): such as A3:A5 ( A-II | A-III | B-I ) ?
 
Last edited:
Upvote 0
I believe the same concept could be applied to your larger data set. The increased number of rows in the Data Pool has no effect.
What isn't clear to me about the Data Entry Range is whether it represents 3 sets of 3-row combinations, or could any 3 row combinations be matched...
(cell references to image in Post #3): such as A3:A5 ( A-II | A-III | B-I ) ?

It is intended to be 3 sets of 3-row combinations.

A2:A4, A5:A7, A8:A10, B2:B4, etc.
 
Upvote 0
Here's one way.

Copy the formula shown in E2 to the cells shown in the shot below.
Excel Workbook
ABCDEFG
1Data EntryHelper Cells for Data Entry
2A-ID-IA-I|A-II|A-IIID-I|D-II|D-III||
3A-IID-II
4A-IIID-III
5B-IB-I|B-II|B-III||||
6B-II
7B-III
8C-IC-I|C-II|C-III||||
9C-II
10C-III
11Data PoolHelper Cells for Data Pool
12A-IB-IC-IA-I|A-II|A-IIIB-I|B-II|B-IIIC-I|C-II|C-III
13A-IIB-IIC-IIA-II|A-III|D-IB-II|B-III|E-IC-II|C-III|F-I
14A-IIIB-IIIC-IIIA-III|D-I|D-IIB-III|E-I|E-IIC-III|F-I|F-II
15D-IE-IF-ID-I|D-II|D-IIIE-I|E-II|E-IIIF-I|F-II|F-III
16D-IIE-IIF-IID-II|D-III|G-IE-II|E-III|H-IF-II|F-III|I-I
17D-IIIE-IIIF-IIID-III|G-I|G-IIE-III|H-I|H-IIF-III|I-I|I-II
18G-IH-II-IG-I|G-II|G-IIIH-I|H-II|H-IIII-I|I-II|F-III
19G-IIH-III-II
20G-IIIH-IIIF-III
Sheet


Then use the CF formula:
=OR(E10:E12=$E$2:$G$2,E10:E12=$E$5:$G$5,E10:E12=$E$8:$G$8)
Applies To: $A$12:$C$20
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,208
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top