How to sum 12 months of data, excluding months that have zero data?

oyeols

New Member
Joined
Aug 2, 2016
Messages
10
Hey chaps,

I have a table that shows monthly production volumes for circa 2 years up to Oct 2016. However, there are months where there is zero production because of shutdown etc. I need a formula that sums 12 months backward rolling production from Oct 16, ignoring the zeros. I.e, if you look at the table below Aug 15 to Oct 16 is 15 months, but because 3 months have zero production, its actually 12 months of production. The file has many of such rows, with the zero production months popping up in different months.

is there a simple formula that would work for all the rows and only add 12 months of production, ignoring the zeros?

Please help. Would be very grateful for any solution to this.



Aug-15Sep-15Oct-15Nov-15Dec-15Jan-16Feb-16Mar-16Apr-16May-16Jun-16Jul-16Aug-16Sep-16Oct-16
84,890 91,260 90,560 80,969 - - 91,941 111,089 - 85,835 26,698 7,637 67,308 72,185 521

<colgroup><col span="15"></colgroup><tbody>
</tbody>
 
Going off of your data in post #4, try this array formula in W2:

=SUM(V2:INDEX(A2:V2,LARGE(COLUMN(A2:V2)*(A2:V2<>"-"),12))) Ctrl Shift Enter

Since he is using the accounting format, I think it should be: =SUM(V2:INDEX(A2:V2,LARGE(COLUMN(A2:V2)*(A2:V2<>0),12)))
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Since he is using the accounting format, I think it should be: =SUM(V2:INDEX(A2:V2,LARGE(COLUMN(A2:V2)*(A2:V2<>0),12)))


Thanks. Cant seem to get it to work though. Gives me the "you've entered too few arguments for this function"

Not sure exactly where I got it wrong...
 
Last edited:
Upvote 0
Just copy and paste it and you should be good to go. Check for trailing spaces after it, however, before pressing CTRL+SHIFT+ENTER.
 
Upvote 0
It seems the formula only works with blanks? What if the blank cells are populated with zeros?

Putting zeros in the blank cells seems to change the outcome of the formula.
 
Last edited:
Upvote 0
The formula I posted works with either blank cells(without formulas) or cells with zeroes. If you input zeroes into blank cells, it shouldn't change the outcome. If you are running into some kind of problem, provide an example please.
 
Upvote 0
It seems the formula only works with blanks? What if the blank cells are populated with zeros?

Putting zeros in the blank cells seems to change the outcome of the formula.

You never said anything about blank cells and your example does not show any blank cells either. If a blank cell is populated with a zero then it is no longer a blank cell. That being said, the formula should still work since excel sees a blank cell as having a value of 0.

Again, the formula that you are using (assuming that your data is in columns A through V starting in row 2) is =SUM(V2:INDEX(A2:V2,LARGE(COLUMN(A2:V2)*(A2:V2<>0),12))) Ctrl Shift Enter
 
Upvote 0

Forum statistics

Threads
1,215,730
Messages
6,126,527
Members
449,316
Latest member
sravya

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