Rolling Total for 2 adjacent columns

Quillcon

New Member
Joined
Jul 10, 2014
Messages
3
This is my first post so please be patient with me! I use Excel 2007.

I have a data set that tracks ingredients in chemical products. For example sake the chemical product is a mixed color, and the calculated ingredient is a primary color.

I need to calculate the quantity of two primary colors based on their percentage of the mixture.

Column A contains the mixed color names. Columns B and C contain the percentage of the primary in each mix.

I began tracking this data in January 2009. Each month I add 3 columns to the worksheet. The 1st column contains the monthly mixed color quantity used. The 2nd and 3rd columns contain the calculation of the two primary colors.

I need the formula to calculate the 12 month rolling total for each primary color. (For July 2014 I need to calculate July 2013 through June 2014)

[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[TD="align: center"]G[/TD]
[TD="align: center"]H[/TD]
[TD="align: center"]I[/TD]
[TD="align: center"]J[/TD]
[TD="align: center"]K[/TD]
[TD="align: center"]L[/TD]
[TD="align: center"]M[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]O[/TD]
[TD="align: center"]P[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1/1/14[/TD]
[TD][/TD]
[TD][/TD]
[TD]2/1/14[/TD]
[TD][/TD]
[TD][/TD]
[TD]3/1/14[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Color[/TD]
[TD]% Red[/TD]
[TD]% Blue[/TD]
[TD="align: center"]Qty[/TD]
[TD]%Red[/TD]
[TD]%Blue[/TD]
[TD="align: center"]Qty[/TD]
[TD]%Red[/TD]
[TD]%Blue[/TD]
[TD="align: center"]Qty[/TD]
[TD]%Red[/TD]
[TD]%Blue[/TD]
[TD][/TD]
[TD]rolling %Red[/TD]
[TD]rolling %Blue[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Orange[/TD]
[TD].5[/TD]
[TD][/TD]
[TD="align: center"]3[/TD]
[TD]=E2*$B$2[/TD]
[TD]=E2*$C$2[/TD]
[TD="align: center"]6[/TD]
[TD]=H2*$B$2[/TD]
[TD]=H2*$C$2[/TD]
[TD="align: center"]2[/TD]
[TD]=K2*$B$2[/TD]
[TD]=K2*$C$2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Purple[/TD]
[TD].5[/TD]
[TD].5[/TD]
[TD="align: center"]7[/TD]
[TD]=E3*$B$3[/TD]
[TD]=E3*$C$3[/TD]
[TD="align: center"]2[/TD]
[TD]=H3*$B$3[/TD]
[TD]=H3*$C$3[/TD]
[TD="align: center"]3[/TD]
[TD]=K3*$B$3[/TD]
[TD]=K3*$C$3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Green[/TD]
[TD][/TD]
[TD].5[/TD]
[TD="align: center"]4[/TD]
[TD]=E4*$B$4[/TD]
[TD]=E4*$C$4[/TD]
[TD="align: center"]4[/TD]
[TD]=H4*$B$4[/TD]
[TD]=H4*$C$4[/TD]
[TD="align: center"]14[/TD]
[TD]=K4*$B$4[/TD]
[TD]=K4*$C$4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Use sumif function. Always keep blank column between summary and data (in this case column n, but will change as months are added). Change the offset range in formula below from -9 to -36 (assuming each period has 3 columns ....3x12=36).

=SUMIF(OFFSET(N$2,0,0,1,-9),O$2,OFFSET(N3,0,0,1,-9)) - this goes in O3 (or first row with live data)
=SUMIF(OFFSET(N$2,0,0,1,-9),P$2,OFFSET(N3,0,0,1,-9)) - this goes in p3

Without going into too deeply on sumifs and offsets:
The sumif is looks for a range of values (the first offset) and compares it to the criteria o$2 and if true adds anything that is found in the range defined by the second offset. The offsets create a range reference starting from the anchor N$2, 1 row x 9 column (to the left ) range.

Let me say that structuring data like this makes your reporting inflexible. While this was expedient in the beginning, it is short sighted. A better structure would have been to have a row for each month with columns a-g and add a column for date. Then you could have a structure that you could report via a pivot table and easily incorporate rolling 12's ,quarterly, yearly, etc..... Again, I realize that at initial design this works, but now that the report has lasted 60 months with no end in sight a structure becomes very important.

By the way, thanks for providing the detailed and well written explanation of what you wanted. I see post after post that lack definition or are so poorly written that you can't help. Good job!
 
Last edited:
Upvote 0
Thank you!
I inherited the tracking table from a previous consultant and am realizing that the % doesn't necessarily need to be calculated each month. Thank you for identifying what I had in my head but had not been able to verbalize.

Now I have a question about pivot tables though. Should I ask that in a new thread and link back to this?
 
Upvote 0
Probably best to start another thread unless the question is specifically how to convert this data to a pivot table.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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