Forum Discussion
Opposite duplicate column
Yvonne2000 With Excel for MS365, there's probably a number of ways to find the duplicates regardless of column order. Here's a few options:
First, you could try to use Conditional Formatting to highlight any team combinations that appear more than once in the list using the ROWS function with FILTER:
=ROWS(FILTER($A$2:$A$11,(($B$2:$B$11=$B2)*($C$2:$C$11=$C2))+(($B$2:$B$11=$C2)*($C$2:$C$11=$B2))))>1
However, this method may not help very much, especially if there are more duplicates than not. As you can see in the screenshot below, the majority of the rows are highlighted, so it does very little to identify which rows are duplicates of each other...
Another option would be to use the BYROW function to SORT each row by columns, then use the UNIQUE function to return the unique list of teams. Since nested arrays are not supported, TEXTJOIN, TEXTBEFORE, TEXTAFTER and HSTACK are also required to make this work:
=LET(
arr, BYROW(B2:C11, LAMBDA(r, TEXTJOIN(",", FALSE, SORT(r,,, TRUE)))),
UNIQUE(HSTACK(TEXTBEFORE(arr, ","), TEXTAFTER(arr, ","))))
UNIQUE Team Combinations
While this method works great for providing a unique list, it still doesn't identify exactly which team numbers were duplicates of each other. The last method I'll offer is to use the XMATCH function to identify the "first match" where each team was found in the list, then use the SORTBY function to sort the results:
=LET(
arr, A2:C11,
_c1, INDEX(arr,,2),
_c2, INDEX(arr,,3),
FindFirst, BYROW(arr, LAMBDA(r, LET(
_e1, INDEX(r,2),
_e2, INDEX(r,3),
XMATCH(1, ((_c1=_e1)*(_c2=_e2))+((_c1=_e2)*(_c2=_e1)))))),
SORTBY(HSTACK(arr, FindFirst), FindFirst))
SORTBY Duplicate Team Combinations
As shown in the screenshot above, this method groups the duplicate teams together, so it's easy to spot the duplicates. Cheers!