Stock & sales calculation

Sigh

Active Member
Joined
Oct 24, 2007
Messages
379
I cells B1-M1 I have the months of the year, In A2 I have the current stock figure, in B2-M2 are the sales figures for each month in the previous year. In N2 I would like a calculation that subtracts the sales from the stock figure and reports the month in which there will be no stock left, is this possible in a formula?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
=INT((A2-SUM(B2:M2))/AVERAGE(B2:M2))+1

This assumes stock is not zero at start of new year. Reports the month as a number
 
Upvote 0
Thanks for your reply. As an example I entered 11 as the stock in A2 and 1 under each of the months, I would expect 11 to be the answer but I get zero?
 
Upvote 0
I spoke too soon! Using the example I quoted earlier, if one of the months is zero the answer is also zero, which is wrong. Also, if I make the stock figure 500 and keep the months at 1 each I get the answer of 8.
 
Upvote 0

Excel 2010
ABCDEFGHIJKLMN
16000JanFebMarAprMayJunJulAugSepOctNovDec
2Sales1,00014001600120012002000200020002000200020002000May
3Sales200018002400120012001200120012001200120012001200March
4
4a
Cell Formulas
RangeFormula
N2{=TEXT(29*MIN(IF(SUBTOTAL(9,OFFSET($B2,0,0,1,COLUMN($B2:$M2)-COLUMN(B2)+1))>=$A$1, COLUMN($B2:$M2)-COLUMN(B2)+1)),"mmmm")}
N3{=TEXT(29*MIN(IF(SUBTOTAL(9,OFFSET($B3,0,0,1,COLUMN($B3:$M3)-COLUMN(B3)+1))>=$A$1, COLUMN($B3:$M3)-COLUMN(B3)+1)),"mmmm")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Wow, thank you so much! My sales run April 16 to March 17, how do I adjust the formula to suit this please?
 
Last edited:
Upvote 0
The major part of the formula yields the position when criteria is met such as 3

MIN(IF(SUBTOTAL(9,OFFSET($B2,0,0,1,COLUMN($B2:$M2)-COLUMN(B2)+1))>=$A$1, COLUMN($B2:$M2)-COLUMN(B2)+1))

Build a lookup table that yields the text that you require instead of

=TEXT(29*num,"mmmm")} which converts a number like 3 to March
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

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