如何计算 Google 电子表格中的对称差异

How to calculate symmetric difference in Google Spreadsheets

我在 A:AB:B 列中有两组值。我想计算这两组之间的 symmetric difference;即从 A:A 中获取那些在 B:B 中不存在的值以及从 B:B[=28 中获取的值=] 在 A:A 中不存在。

到目前为止我正在使用它并且它有效:

=FILTER({filter(A2:A,countif(B2:B,A2:A)=0);filter(B2:B,countif(A2:A,C2:C)=0)},{filter(A2:A,countif(B2:B,A2:A)=0);filter(B2:B,countif(A2:A,B2:B)=0)}<>"")

有没有更有效的方法来完成这个?

get those values from A:A that do not exist in B:B AND values from B:B that do not exist in A:A

=QUERY({
 FILTER(A:A, NOT(COUNTIF(B:B, A:A))); 
 FILTER(B:B, NOT(COUNTIF(A:A, B:B)))}, 
 "where Col1 is not null", 0)