如何合并不同的工作表中的列而不重复?

如何将两个不同的工作表中的两列数据合并到第三个工作表中的一列而不重复?

例如:

表1

ID 1 2 3 

和表2

 ID 1 6 7 3 

成为表3

 1 2 3 6 7 

有可能通过延伸通常的公式列出唯一值来做到这一点

 =INDEX(Sheet1!$A$2:$A$4, MATCH(0, COUNTIF($a$1:a1, Sheet1!$A$2:$A$4), 0)) 

为第一个名单

 =INDEX(Sheet2!$A$2:$A$5, MATCH(0, COUNTIF($a$1:a1, Sheet2!$A$2:$A$5), 0)) 

为第二个名单

在伪代码中

 If at end of first list If at end of second list Show nothing Else Show next item from second list Else If at end of second list Show next item from first list ELse Show smaller of (next item from first list, next item from second list) 

所以这个组合公式就是了

 =IF(ISERROR(INDEX(Sheet1!$A$2:$A$4, MATCH(0, COUNTIF($A$1:A1, Sheet1!$A$2:$A$4), 0))), IF(ISERROR(INDEX(Sheet2!$A$2:$A$5, MATCH(0, COUNTIF($A$1:A1, Sheet2!$A$2:$A$5), 0))), "", INDEX(Sheet2!$A$2:$A$5, MATCH(0, COUNTIF($A$1:A1, Sheet2!$A$2:$A$5), 0))), IF(ISERROR(INDEX(Sheet2!$A$2:$A$5, MATCH(0, COUNTIF($A$1:A1, Sheet2!$A$2:$A$5), 0))), INDEX(Sheet1!$A$2:$A$4, MATCH(0, COUNTIF($A$1:A1, Sheet1!$A$2:$A$4), 0)), MIN(INDEX(Sheet1!$A$2:$A$4, MATCH(0, COUNTIF($A$1:A1, Sheet1!$A$2:$A$4), 0)), INDEX(Sheet2!$A$2:$A$5, MATCH(0, COUNTIF($A$1:A1, Sheet2!$A$2:$A$5), 0))) )) 

从Sheet3!A2开始。

所有这些都是数组公式。

此版本仅适用于数字。

适用于数字和文本的版本: –

 =IF(ISERROR(INDEX(Sheet1!$A$2:$A$4,MATCH(0,COUNTIF($A$1:A1,Sheet1! $A$2:$A$4),0))), IF(ISERROR(INDEX(Sheet2!$A$2:$A$5,MATCH(0,COUNTIF($A$1:A1,Sheet2! $A$2:$A$5),0))), "", INDEX(Sheet2!$A$2:$A$5,MATCH(0,COUNTIF($A$1:A1,Sheet2!$A$2:$A$5),0))), IF(ISERROR(INDEX(Sheet2!$A$2:$A$5,MATCH(0,COUNTIF($A$1:A1,Sheet2!$A$2:$A$5),0))), INDEX(Sheet1!$A$2:$A$4,MATCH(0,COUNTIF($A$1:A1,Sheet1!$A$2:$A$4),0)), IF( INDEX(Sheet1!$A$2:$A$4,MATCH(0,COUNTIF($A$1:A1,Sheet1!$A$2:$A$4),0)) <INDEX(Sheet2!$A$2:$A$5,MATCH(0,COUNTIF($A$1:A1,Sheet2!$A$2:$A$5),0)), INDEX(Sheet1!$A$2:$A$4,MATCH(0,COUNTIF($A$1:A1,Sheet1!$A$2:$A$4),0)), INDEX (Sheet2!$A$2:$A$5,MATCH(0,COUNTIF($A$1:A1,Sheet2!$A$2:$A$5),0))) )) 

x不sorting

x不跳过空格

✓如果列表已经是升序,是否保留订单。