Annual SUMPRODUCT from decades of data

ReEngineer

New Member
Joined
Oct 23, 2011
Messages
2
I have data in column B and months in column A and number of days in column C. I have to sumproduct annual data in the following way.
Multiply production for a particular month with the number of days in that month (it would be nice to somehow incorporate the number of days in month rather than manually calculating them) and sum this for for 2012 and then divide it by the number of days in that year. This gives me an annualized data. I want to do this for 2013, 2014 and so on without manually typing in the formula as it becomes too tedious.

Annual production
2012 =SUMPRODUCT(B1:B12,C1:C12)/SUM(C1:C12)
2013 =SUMPRODUCT(B13:B24,C13:C24)/SUM(C13:C24)
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I have arranged the sheet as follows - change formulas to match your data

Row 1 - Headers

Row 2 onwards
Col A
Date (Month and Year)
Col B
Data
Col C
No of days in a month Formula =DAY(EOMONTH(A2,0))

Col E
Year - for your report
Col F
=SUMPRODUCT(--(YEAR($A$2:$A$500)=E2),$B$2:$B$500,$C$2:$C$500)/SUMPRODUCT(--(YEAR($A$2:$A$500)=E2),$C$2:$C$500)

The formula assumes you have data till row 500 extend as necessary

hope it helps
 
Upvote 0
It would need a long post to explain exactly. But simply put the YEAR($A$2:$A$500)=E2 creates an array which has TRUE if the year is equal to the report year and FALSE otherwise.

The double negation "--" converts the TRUE to 1 and FALSE to 0. Then the sumproduct just multiplies the arrays as usual.

A really nice explaination of what is possible with sumproduct given by Daniel Ferry LINK:
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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