There are a few approaches I think, but the first one that came to mind was to create a key for each row based on the values in the two key columns, and then de-duplicate based on that key.
E.g. if first two cols are 'Col1' and 'Col2'. Create new column based on 'Col2' with the following expression
(value + "|" + row.cells.Col1.value).split("|").sort().join("")"
This puts the two values into an array, sorts the array and then rejoins the array into a string with no separator - results in
AA
AB
AB
DF
VF
You can then facet on this key to find duplicates and remove them.
Owen