Search textjoined rows for duplicates and consider different orders a duplicate

andrew_milonavic

Board Regular
Joined
Nov 16, 2016
Messages
98
Hi,

I have 10 text-joined rows, A1-A10, each with up to 12 items and separated by a " / " as the delimiter. Is it possible to flag duplicates with a color, including when the order might different? i.e if A1 has bear / fish / cat and A2 has fish / bear / cat then they will be considered duplicates.

Possible with a formula?

If the duplicates cannot be flagged with a color I'm open to other options including adding extra columns or rows. I just need a fast way to show duplicates.

Thanks

Andrew
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
As you are looking at whole words/strings you would need a custom function to split the cell on slash into parts sort parts into order then rebuild string with sorted parts and slash to then compare so would need vba custom function unless of course someone comes up with a different solution
 
Upvote 0
Would Bear / Cat / Fish be considered a duplicate of Bear / Dog / Cat / Fish, or should it only be rows where all words are duplicated?
 
Upvote 0
Hi Jimrward,

Thanks for the reply.

Is it any easier to search for duplicates prior to all the items being text joined?

Thanks

Andrew
 
Upvote 0
The function would return an ordered string to compare with another ordered string

Unless you wanted to return a string in c1 etc then use countif to catch multiple duplicates
 
Upvote 0
Hi Jimrward,

My preferred way would be to search the text-joined cells for duplicates. If that's not possible using formulas than I'm open to any other approach that can show the duplicates. I'll make adjustments to my data where needed.

Thanks

Andrew
 
Upvote 0
quickly knocked together the following

Code:
Function Ordered(str As String) As String

arr = Split(str, "/")

Call BubbleSort(arr)
Ordered = Join(arr, "/")
End Function
Sub BubbleSort(arr)
  Dim strTemp As String
  Dim i As Long
  Dim j As Long
  Dim lngMin As Long
  Dim lngMax As Long
  lngMin = LBound(arr)
  lngMax = UBound(arr)
  For i = lngMin To lngMax - 1
    For j = i + 1 To lngMax
      If arr(i) > arr(j) Then
        strTemp = arr(i)
        arr(i) = arr(j)
        arr(j) = strTemp
      End If
    Next j
  Next i
End Sub

can be used say in cell c1 =ordered(a1)

or =IF(ordered(A1)=ordered(A2),"dup","")
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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