INTERSECT

Takes two arrays, treated as sets (i.e. ignoring duplicate values), and returns a new array that contains only items that are contained in both. If the input arrays have no items in common, returns an empty array.

Syntax

=INTERSECT(array1, array2)

Examples

=INTERSECT([1, 2, 3], [3, 4, 5])[3]
=INTERSECT(["A", "B"], [1, 2])\[]
=INTERSECT([OBJECT("A", 1), OBJECT("B", 2), OBJECT("A", 1, "B", 2)], [OBJECT("A", 1), OBJECT("B", 2)])[{"A": 1}, {"B": 2}]