Ⅰ 利用宏查询数据汇总到另一张表的对应位置

我先假设个条件:
X表为sheet1,人名为A1:A4,,业绩在B1:B4
Y表为sheet2,人名从A1开始

1.那么:在sheet2(Y表)的A1中输入公式:
=IF(ISERR(INDEX(Sheet1!$A$1:$A$1000,SMALL(IF(COUNTIF(INDIRECT("SHEET1!A1:A"&ROW($A$1:$A$1000)),Sheet1!$A$1:$A$1000)=1,ROW($A$1:$A$1000),""),ROW(A1)))),"",INDEX(Sheet1!$A$1:$A$1000,SMALL(IF(COUNTIF(INDIRECT("SHEET1!A1:A"&ROW($A$1:$A$1000)),Sheet1!$A$1:$A$1000)=1,ROW($A$1:$A$1000),""),ROW(A1))))
这是数组公式,输入后同时按ctrl+shift+enter 3键
2.在sheet2(Y表)的B1中输入公式:
=IF(A1<>"",SUMIF(Sheet1!A:A,A1,Sheet1!B:B),"")
这是普通公式,输入后只要按回车键即可

然后选择A1,B1,一起下拉复制到1000行