简体   繁体   English

Excel SUMIF 偏移量

[英]Excel SUMIF Offset

I have a spreadsheet that is used for inventory planning.我有一个用于库存计划的电子表格。 It has, in columns, 5 weeks (per month) followed by a month total, then another 5 weeks, followed by another month total, and so on for 12 months.它在列中有 5 周(每月),然后是一个月的总数,然后是另外 5 周,接着是另一个月的总数,依此类推 12 个月。 Each week column is labelled "Wk 1", "Wk 2" and so on.每个星期列都标有“第 1 周”、“第 2 周”等。 Each Month is labelled as "Jan", "Feb" and so on.每个月都标记为“一月”、“二月”等。

I have the product code at cell A2, and a lead time (in weeks) at cell C2.我在单元格 A2 中有产品代码,在单元格 C2 中有提前期(以周为单位)。 The lead time varies by product.交货时间因产品而异。

Column B is the first column with data (column A is used for labels). B 列是包含数据的第一列(A 列用于标签)。

On row 5 there is opening stock on hand.第 5 行有期初库存。 On row 6 there is the sales forecast.第 6 行是销售预测。 On row 7 there are Purchase Orders received.第 7 行是收到的采购订单。 On row 8 is closing stock on hand.第 8 行是手头的期末库存。

Row 10 is a staging area.第 10 行是暂存区。 This is my problem row.这是我的问题行。 These are my planned orders.这些是我计划好的订单。

My cell B10 formula is =SUM(B6:OFFSET(B6,0,C2-1)).我的单元格 B10 公式是 =SUM(B6:OFFSET(B6,0,C2-1))。 My planned purchase order = planned sales for the next x weeks, so I need to exclude the month columns.我的计划采购订单 = 未来 x 周的计划销售额,因此我需要排除月份列。

The result should be as shown in cell B11.结果应如单元格 B11 中所示。 Formula for that cell is =SUM(B6:F6)+SUM(H6:K6)+SUM(N6:R6).该单元格的公式为 =SUM(B6:F6)+SUM(H6:K6)+SUM(N6:R6)。 Note that cell L6 is excluded.请注意,单元格 L6 被排除在外。

Not sure how to increase the number of columns to include in the offset as a lead time may be 26 weeks, so there could be a few "month" columns I need to exclude, and then how to exclude the monthly totals?不确定如何增加要包含在偏移量中的列数,因为提前期可能是 26 周,所以我可能需要排除一些“月”列,然后如何排除每月总计?

I'm thinking maybe using a Sumif combined with Offset, but I am scratching my head.我在想也许可以将 Sumif 与 Offset 结合使用,但我正在摸不着头脑。

Your help will be much appreciated.非常感谢您的帮助。

Image of Excel file showing structure显示结构的 Excel 文件的图片

Havent tried anything, as am unsure what to try.还没有尝试过任何东西,因为我不确定要尝试什么。

see attached photo for your answer.请参阅所附照片以获取答案。

The formula you seek for cell B10 is: =SUMIFS(OFFSET(B6,0,0,1,C2+(COUNTA(B4:ZZ4)-COUNTIF(B4:ZZ4,"wk*")+COUNTIF(B3:ZZ3,"exclude"))),OFFSET(B4,0,0,1,C2+(COUNTA(B4:ZZ4)-COUNTIF(B4:ZZ4,"wk*")+COUNTIF(B3:ZZ3,"exclude"))),"=wk*")您为单元格 B10 寻找的公式是:=SUMIFS(OFFSET(B6,0,0,1,C2+(COUNTA(B4:ZZ4)-COUNTIF(B4:ZZ4,"wk*")+COUNTIF(B3:ZZ3," exclude"))),OFFSET(B4,0,0,1,C2+(COUNTA(B4:ZZ4)-COUNTIF(B4:ZZ4,"wk*")+COUNTIF(B3:ZZ3,"exclude"))), "=周*")

Solution解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM