Sum until function

Andre Pires

New Member
Joined
Dec 9, 2019
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Dear all,

I would like an excel formula to provide me how many rows until a certain sum is reached:

For instance:

1575891639338.png


here you'll see that I have 383 in stock and I would like to know how many week until I deplete the stock.

According to the calculus it should cover until W51 (where the final outcome by excel should be 6). Notice also that the opening stock might not sum exactly the value (this would be it would be between 4 or 5 weeks)

In general it would a function Sum until x value - but such function doesn't exist.

Can you help me with this?

Regards
 

Attachments

  • 1575891530211.png
    1575891530211.png
    28.1 KB · Views: 10
  • 1575891620653.png
    1575891620653.png
    4.7 KB · Views: 10

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
1575894700349.png


This will calculate the difference between a cell in column M and the cells in 4th row from column Q onwards(since you have told it can be from 4th week onwards). If its less than 5, the count of the cell from column "N" will be displayed in N6. You can customize as per your needs.

The formula is like: =IF((M11-Q9)<5,COUNT(N9:Q9),IF((M11-R9)<5,COUNT(N9:R9),IF((M11-S9)<5,COUNT(N9:S9),COUNT(N9:T9))))
 

Attachments

  • 1575894700205.png
    1575894700205.png
    3.4 KB · Views: 2
Upvote 0
Hi
Assuming your weekly totals are in cells B3 through H3 and your Opening stock is in B4
then the following array formula entered or amended by pressing Control+Shift+Enter (CSE) and not just Enter will give the result

{=MIN(IF(SUBTOTAL(9,OFFSET($B$3,0,0,1,COLUMN($B$3:$H$3)-COLUMN(B3)+1))>=B4,COLUMN($B$3:$H$3)-COLUMN(B3)+1))}

Do not type the curly braces { } yourself, Excel will enter thn when you use CSE
 
Upvote 0
Hey Roger,

It's working than
Hi
Assuming your weekly totals are in cells B3 through H3 and your Opening stock is in B4
then the following array formula entered or amended by pressing Control+Shift+Enter (CSE) and not just Enter will give the result

{=MIN(IF(SUBTOTAL(9,OFFSET($B$3,0,0,1,COLUMN($B$3:$H$3)-COLUMN(B3)+1))>=B4,COLUMN($B$3:$H$3)-COLUMN(B3)+1))}

Do not type the curly braces { } yourself, Excel will enter thn when you use CSE


hey Roger,

It's working perfectly with that formula you just provided me.

Thank you so much for that.

If you ever come to Portugal I'll be more than happy to pay you a beer ahah

Cheers
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,257
Members
448,880
Latest member
aveternik

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top