Find duplicates in column pairs??

squirrellydw

Board Regular
Joined
Apr 2, 2015
Messages
90
Office Version
  1. 365
Platform
  1. Windows
Is there an easy way find duplicate names the show up in different columns? The tricky part is it would have to cover columns in pairs for example if John Doe is listed in column B and K, or C and L, or D and M, or E and N, or F and O, or G and P, or H and Q. I have it working now but I had to make a rule for each column? Just trying to find an easier / better way.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
t if there is a blank cell it's filling in red,
I don't think those cells are are completely blank. Perhaps they have a formula returning "" (or previously had a formula returning "" and cells have had values pasted)


In any case ..
is there away to have it ignore blank cells so they are not filled in?
.. 'Yes'

Change the CF formula to this and you won't need the extra 'white' conditional formatting.
Excel Formula:
=AND(MATCH(B2,OFFSET(B2,-ROW(B2)+1,9-18*(COLUMN(B2)>9),100),0),B2<>"")
 
Upvote 0
That worked, thank you. What the best way to check if they have a formula in the cells, I thought I deleted all them.
 
Last edited:
Upvote 0
My bad, that didn't work. it fixed the blanks but now none of the duplicates show in red
 
Upvote 0
Firstly, note that I mentioned that the cells may not have a formula but may have had one in the past and removed by Copy/Paste Special (Values)

You can check what cells have formula by selecting a range of cells, pressing F5 -> Special .. -> Formulas -> OK
Only cells with formulas in the originally selected range will now be selected.

it fixed the blanks but now none of the duplicates show in red
Hmm, I'm not sure why that happened, Try writing the formula this way.

25 02 03.xlsm
ABCDEFGHIJKLMNOPQ
1
2LHKOLZUXVDAEURUXSXFOZSDGMEKN
3XXXQIYZQKFPOJLSFJLCSUVBENUNA
4YVFEQIQCXBFWGDKXNSVHIOVKNFJL
5PVIOROPLLQVUCPZSIBRFJISXCYGX
6WYIBSJQBHAXKWRUNYXKXBUWQKTBE
7FZCIYPEONCCWFJBNTJQVQFVWGCIG
8PSQMEVKDIQZSQYGMFTCMYWZIPORE
9IJDAYMRBMLAMDRWSMOXCYCPOCR
10WOXVOGNAAISGLOCKOIQJNGPOES
11 UBTPSCQUJIRHOSZMHKHKLDPOLO
12WNZOSSJSFAIEWTVKJMXTKTMJSZ
13PAAKFDUUTUXOQY FPQFIRVNMKHG
14ISOVBVVINPTGNZ FYDTRIJSNUDD
15GPHFGVMDYHQJGKXJMYTBANSEPO
16CMLLXSFGTYWXFLSCMIVHZQKEXOVB
17YFNPBXVONJOCZZJFWBDCCDUOJEJZ
18FFHGLHJEPEABEYHAFPGPESJRFDRO
19PADUUKGJPZKPTMMSKOTEIBVLGYQY
20SYDYVCWPHPQLFBUXQQOKBLXXMZUS
CF Dupes (3)
Cell Formulas
RangeFormula
B11,K13:K14B11=IF(1=2,5,"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:Q20Expression=MATCH(B2,OFFSET(B2,-ROW(B2)+1,9-18*(COLUMN(B2)>9),100),0)*(B2<>"")textNO
 
Upvote 0
Solution
@Peter_SSs Personally, I thought your first suggestion using relative column references was the best one. The same concept can also be used with one rule; plus, the length of the lookup range can be reduced with Trim Refs (pending release to all channels). For example, with cell B2 selected (active):

Formula: =IF(B2<>"",IF(COLUMN()<COLUMN($K$2),MATCH(B2,K:.K,0),MATCH(B2,XEW:.XEW,0)))
Applies to: =$B$2:$H$100,$K$2:$Q$100

Note: =IF(B2<>"",MATCH(B2,IF(COLUMN()<COLUMN($K$2),K:.K,XEW:.XEW),0)) is shorter, but will match 0's with blank cells when used in Conditional Formatting.

While column XEW is technically 16,375 columns to the right of column B, it's also 9 columns to the left of column B (relatively speaking). When the formula is applied to column K, it will be referencing column B.

Cheers!
 
Upvote 0
@djclements
Thank you for that additional information. I was not even aware of Trim refs (or TRIMRANGE) but they look interesting.

However, I am not understanding how it is working. In the mini sheet below, it works in conditional formatting applied across the columns shown, but not as a worksheet formula applied across those columns. What am I missing?

Although I just copied the B5 formula down and across, the formulas change when the hit column J. Not only does the #REF! appear in the formula (not unexpected but where it appears is unexpected) but the whole structure & order of the formula has changed. I have not seen anything like that before. :confused:

25 02 03.xlsm
ABCDEFGHIJKLMNOPQ
1
2LHKOLZUXVDAEURUXSXFOZSDGMEKN
3UXXQIYZQKFPOJLSFJLCSUVBENUNA
4
5#N/A#N/A#N/A#N/A#N/A#N/A#N/AFALSEFALSE#REF!#REF!#REF!#REF!#REF!#REF!#REF!
62#N/A#N/A#N/A#N/A#N/A#N/AFALSEFALSE#REF!#REF!#REF!#REF!#REF!#REF!#REF!
CF Dupes (4)
Cell Formulas
RangeFormula
B5:I6B5=IF(B2<>"",IF(COLUMN()<COLUMN($K$2),MATCH(B2,K:.K,0),MATCH(B2,XEW:.XEW,0)))
J5:Q6J5=J2<>"" IF(COLUMN()<COLUMN($K$2),IF(MATCH(J2,S:.S,0),J2,MATCH(#REF!,,0)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:Q3Expression=IF(B2<>"",IF(COLUMN()<COLUMN($K$2),MATCH(B2,K:.K,0),MATCH(B2,XEW:.XEW,0)))textNO
 
Upvote 0
@Peter_SSs
This behavior of relative column references starting over at column A, after reaching the last column (XFD), does not apply when using a standard range reference directly in the worksheet. However, it will work in Conditional Formatting, as well as in Name Manager. For example, if you were to select cell B2 and define a name called "Col9ToLeft" that Refers to: =!XEW:.XEW, when you select cell K2 afterwards and go back into Name Manager, you will see the definition now Refers to: =!B:.B.

After doing so, =IF(B2<>"",IF(COLUMN()<COLUMN($K$2),MATCH(B2,K:.K,0),MATCH(B2,Col9ToLeft,0))) will work, BUT it will create a circular reference when dragged across to columns K thru Q in your mini-sheet example, because the formulas used in rows 5 and 6 will be included in the lookup range, due to the use of Trim Refs, and will be cross-referencing each other. For testing purposes, just change K:.K to K$2:K$3 and it will work as expected. ;)
 
Upvote 0

Forum statistics

Threads
1,226,462
Messages
6,191,174
Members
453,644
Latest member
karlpravin

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