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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,215,174
Messages
6,123,451
Members
449,100
Latest member
sktz

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