Home > OS >  Excel - How do I calculate sum of products bought in a period of time based on X lead days
Excel - How do I calculate sum of products bought in a period of time based on X lead days

Time:12-14

I am creating a formula to try yo find the total amount in pounds that is in in-transit. The current lead time is 5 days. But I have placed a manual override where we could change the lead time to 10 days for example. How do I get it to change outcome to be similar to the 2nd picture below.

the equation in the first white cell is the following =SUM(OFFSET(B1,0,0,5)) where 5 is the default lead time, but I would like to have that change depending on whether there is a value in the lead-times override (Final Column)

This equation is dragged down to the remaining white cells in this table so that the last white cell is =SUM(OFFSET(B12,0,0,5))

Current Results

This is what I want it to look like

Desired results

Sorry if I am unclear in my question since, it is a bit hard to explain in writing.

CodePudding user response:

Just check if the value exists and use it. If not, fall back to 5.

=SUM(OFFSET(B1,0,0,IF(NOT(ISBLANK($C$9)), $C$9, 5)))

Don't forget to make the override cell static (with the dollar signs) or they will shift when dragging your formula.

CodePudding user response:

The problem with this solution is that the override will not always be in cell C9. The entire C column is where I input the override. The row where the override is, could change. Below are some examples of what I want to happen.

Scenario 1

Scenario 2

Scenario 3

Scenario 4

  • Related