Summing a range and multiplying it by another

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,047
Morning all,

I have a feeling that SUMPRODUCT is the function I need for this but unsure how best to go about it

Code:
Mar	Apr	May	Jun	Jul	Aug	Sep	Oct	Nov	Dec	Jan	Feb
											
1	1	1	1	0.8	0.8	0.8	0.8	0.8	0.8	0.8	0.8
											
3200	1800	2388	1200	1900	2460	3150	1578	3650	6504	6800	4506

I need a formula that will calculate how much money is made, divided by the top row

The dates for this will change ...for example

Cell A1 will contain the start month (which can change)

Cell A2 will contain the finish month(which can also change)

If A1 was Jun and A2 was Feb

I would sum from 1200 to 4506 and multiply it by the numbers directly above.....long winded explanation would be

1200 * 1
1900 * 0.8
2460 *0.8

and so on

Any ideas please ?

Thanks in advance
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Are they dates formatted as months or just text? If text will that span of months ever be longer than 12 months?
 
Upvote 0
this works, but I'm sure there is a better solution


Book1
ABCDEFGHIJKL
1MarAprMayJunJulAugSepOctNovDecJanFeb
211110.80.80.80.80.80.80.80.8
3320018002388120019002460315015783650650468004506
4
5Jun
6Feb
725638.4
Sheet1
Cell Formulas
RangeFormula
A7=SUMPRODUCT(OFFSET(A2,0,MATCH(A5,$A$1:$L$1,0)-1,1,MATCH(A6,$A$1:$L$1,0)-MATCH(A5,$A$1:$L$1,0)+1),OFFSET(A3,0,MATCH(A5,$A$1:$L$1,0)-1,1,MATCH(A6,$A$1:$L$1,0)-MATCH(A5,$A$1:$L$1,0)+1))
 
Upvote 0
Are they dates formatted as months or just text? If text will that span of months ever be longer than 12 months?

Hello Steve, yes they are text and yes there would be 24 months, the current year and previous year (figures always on rotation) The previous year months would appear as Jan1 Feb1 Mar1 etc etc
 
Upvote 0
this works, but I'm sure there is a better solution


Book1
ABCDEFGHIJKL
1MarAprMayJunJulAugSepOctNovDecJanFeb
211110.80.80.80.80.80.80.80.8
3320018002388120019002460315015783650650468004506
4
5Jun
6Feb
725638.4
Sheet1
Cell Formulas
RangeFormula
A7=SUMPRODUCT(OFFSET(A2,0,MATCH(A5,$A$1:$L$1,0)-1,1,MATCH(A6,$A$1:$L$1,0)-MATCH(A5,$A$1:$L$1,0)+1),OFFSET(A3,0,MATCH(A5,$A$1:$L$1,0)-1,1,MATCH(A6,$A$1:$L$1,0)-MATCH(A5,$A$1:$L$1,0)+1))

Hi Alan, thanks for this, i will give it a go
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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