Remove duplicate tags if values are equal

Hi experts,
many of my files have multiple tags with the same value. For example two YEAR tags with the same value of 2009.
I've tried to remove those duplicate tags with the quick action, but it removes all duplicate tags, independently of the value. So I would lost information.

Is it possible to remove duplicate tags only when the values are equal?

Try
"$if($eql($meta(year,0),$meta(year,1)),1,0)" IS "1"
Select the files,
Delete the superfluous YEAR field with the extended tags dialogue.

It works!

Many thanks