如图,图1加一辅助列F
F2=COUNT(B2:E2)
图2:
A2=OFFSET(Sheet1!$A$1,LOOKUP(ROW()-2,SUBTOTAL(9,OFFSET(Sheet1!$F$1,,,ROW($1:$5),)),ROW($1:$5)),,,)
B2=OFFSET(Sheet1!$A$1,,SMALL(IF(OFFSET(Sheet1!$B$1,MATCH(A2,Sheet1!$A$2:$A$5,0),,,4)>0,COLUMN($A:$D),4^8),COUNTIF($A$2:A2,A2)),,)
数组公式
C2=OFFSET(Sheet1!$A$1,MATCH(A2,Sheet1!$A$2:$A$5,0),MATCH(B2,Sheet1!$B$1:$E$1,0),,)
百度多条件求和sumifs()
如果数据在sheet2的A到C列,在sheet1的B2公式:=sumifs(sheet2!$c:$c,sheet2!$a:$a,$a2,sheet2!$b:$b,b$1)
用宏计算吧,