感谢老师的知道
另外我想在RANGE("H2")插入一个公式,可是太长,在VBE里一直提示红色无法运行,麻烦老师帮我看看改怎么写代码
公式如下:=INT((SUMIFS(生产领料序时簿!K:K,生产领料序时簿!M:M,IF(MONTH(TODAY())-1=0,YEAR(TODAY())-1&"-12",YEAR(TODAY())&"-"&MONTH(TODAY())-1),生产领料序时簿!H:H,B2)+SUMIFS(生产领料序时簿!K:K,生产领料序时簿!M:M,IF(MONTH(TODAY())-2=0,YEAR(TODAY())-1&"-12",IF(MONTH(TODAY())-2=-1,YEAR(TODAY())-1&"-11",YEAR(TODAY())&"-"&MONTH(TODAY())-2)),生产领料序时簿!H:H,B2)+SUMIFS(生产领料序时簿!K:K,生产领料序时簿!M:M,IF(MONTH(TODAY())-3=0,YEAR(TODAY())-1&"-12",IF(MONTH(TODAY())-3=-1,YEAR(TODAY())-1&"-11",IF(MONTH(TODAY())-3=-2,YEAR(TODAY())-1&"-10",YEAR(TODAY())&"-"&MONTH(TODAY())-3))),生产领料序时簿!H:H,B2)+SUMIFS(生产领料序时簿!K:K,生产领料序时簿!M:M,IF(MONTH(TODAY())-4=0,YEAR(TODAY())-1&"-12",IF(MONTH(TODAY())-4=-1,YEAR(TODAY())-1&"-11",IF(MONTH(TODAY())-4=-2,YEAR(TODAY())-1&"-10",IF(MONTH(TODAY())-4=-3,YEAR(TODAY())-1&"-9",YEAR(TODAY())&"-"&MONTH(TODAY())-4)))),生产领料序时簿!H:H,B2)+SUMIFS(生产领料序时簿!K:K,生产领料序时簿!M:M,IF(MONTH(TODAY())-5=0,YEAR(TODAY())-1&"-12",IF(MONTH(TODAY())-5=-1,YEAR(TODAY())-1&"-11",IF(MONTH(TODAY())-5=-2,YEAR(TODAY())-1&"-10",IF(MONTH(TODAY())-5=-3,YEAR(TODAY())-1&"-9",IF(MONTH(TODAY())-5=-4,YEAR(TODAY())-1&"-8",YEAR(TODAY())&"-"&MONTH(TODAY())-5))))),生产领料序时簿!H:H,B2)+SUMIFS(生产领料序时簿!K:K,生产领料序时簿!M:M,IF(MONTH(TODAY())-6=0,YEAR(TODAY())-1&"-12",IF(MONTH(TODAY())-6=-1,YEAR(TODAY())-1&"-11",IF(MONTH(TODAY())-6=-2,YEAR(TODAY())-1&"-10",IF(MONTH(TODAY())-6=-3,YEAR(TODAY())-1&"-9",IF(MONTH(TODAY())-6=-4,YEAR(TODAY())-1&"-8",IF(MONTH(TODAY())-6=-5,YEAR(TODAY())-1&"-7",YEAR(TODAY())&"-"&MONTH(TODAY())-6)))))),生产领料序时簿!H:H,B2))/6) |