这是我做的移动平均单价,看得我自已都晕=IF(A2="","",(SUMIF(期初!$A$2:$A$6,A2,期初!$N$2:$N$6000)+IF(ISNA(MATCH(J2,入库!$J:$J)),0,SUMIF(INDIRECT("入库!$A$1:$A$"&MATCH(J2,入库!$J:$J)),A2,INDIRECT("入库!$I$1:$I$"&MATCH(J2,入库!$J:$J))))-SUMIF(INDIRECT("出库!$A$1:$A$"&ROW(J2)-1),A2,INDIRECT("出库!$I$1:$I$"&ROW(J2)-1)))/(SUMIF(期初!$A$2:$A$6,A2,期初!$M$2:$M$6000)+IF(ISNA(MATCH(J2,入库!$J:$J)),0,SUMIF(INDIRECT("入库!$A$1:$A$"&MATCH(J2,入库!$J:$J)),A2,INDIRECT("入库!$G$1:$G$"&MATCH(J2,入库!$J:$J))))-SUMIF(INDIRECT("出库!$A$1:$A$"&ROW(J2)-1),A2,INDIRECT("出库!$G$1:$G$"&ROW(J2)-1)))) |