Count duplicates in non-adjacent cells

CP11

New Member
Joined
Jun 8, 2022
Messages
11
Office Version
  1. 2021
Platform
  1. Windows
Hi,

How can I compare duplicates in a non-continuous range?

I would like to check if there are any duplicates values in a row, however only compare specified cells which are not next to each other.

I have been able to do this with conditional formatting, however need it as a cell value too.

I.e. in the below example the 2nd row doesn't count the value ABC124 in the 2nd or 6th column

CompareIgnoreCompareIgnoreCompareIgnoreCompareIgnoreCompareIgnoreDuplicates in row?
ABC121ABC124ABC123ABC126ABC127ABC128ABC123ABC130ABC131ABC132Yes
ABC124ABC124ABC125ABC126ABC127ABC124ABC129ABC130ABC131ABC132No


Thank you
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi & welcome to MrExcel.
How about
Fluff.xlsm
ABCDEFGHIJK
1CompareIgnoreCompareIgnoreCompareIgnoreCompareIgnoreCompareIgnoreDuplicates in row?
2ABC121ABC124ABC123ABC126ABC127ABC128ABC123ABC130ABC131ABC132Yes
3ABC124ABC124ABC125ABC126ABC127ABC124ABC129ABC130ABC131ABC132No
Main
Cell Formulas
RangeFormula
K2K2=LET(f,FILTER(A2:J2,$A$1:$J$1="Compare"),IF(COLUMNS(f)<>COLUMNS(UNIQUE(f,1)),"Yes","No"))
K3K3=LET(f,FILTER(A3:J3,$A$1:$J$1="Compare"),IF(COLUMNS(f)<>COLUMNS(UNIQUE(f)),"Yes","No"))
 
Upvote 0
Hello,

This works perfectly, thank you. I have a slight amendment:

The columns to compare will always be the same (A, C, E, G, I) and won't have the 'Compare' / 'Ignore' headers above them.

Is it possible to filter by the specified columns, rather than filter columns with a 'Compare' header?

Thank you
 
Upvote 0
Ok, how about
Excel Formula:
=LET(f,FILTER(A2:J2,MOD(COLUMN($A$1:$J$1),2)=1),IF(COLUMNS(f)<>COLUMNS(UNIQUE(f,1)),"Yes","No"))
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Hi. Sorry, one more thing!

How do I exclude blanks within the range from being counted as duplicates?

Thank you
 
Upvote 0
Try
Excel Formula:
=LET(f,FILTER(A2:J2,(MOD(COLUMN($A$1:$J$1),2)=1)*(A2:J2<>"")),IF(COLUMNS(f)<>COLUMNS(UNIQUE(f,1)),"Yes","No"))
 
Upvote 0
Thank you, this works if there are non-blanks as well as blanks. But if the whole row is blank it throws a calc error:

1654716024691.png
 
Upvote 0
In that case try
Excel Formula:
=LET(f,FILTER(A2:J2,(MOD(COLUMN($A$1:$J$1),2)=1)*(A2:J2<>""),""),IF(COLUMNS(f)<>COLUMNS(UNIQUE(f,1)),"Yes","No"))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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