Taking a pro rata average

maudley

New Member
Joined
Oct 15, 2015
Messages
1
I have a 'Start Date' and an 'End Date' Column, which contain a data range on one sheet. And I have a table on another sheet which contains a 'Date' column and a 'Value' column.

I would like to calculate the average value for the period between the 'Start Date' and an 'End Date'

For example:

Sheet 1

'Start Date', 'End Date'
28/02/15, 03/03/15

Sheet 2

'Date', 'Value'
28/02/15, 20
01/03/15, 30
02/03/15, 30
03/03/15, 30

Calculation I would like to perform

There are 4 days between 28/02/15 and 03/03/15:

'Day', 'Value'
1, 20
2, 30
3, 30
4, 30


Average Value for date range: ((3 x 30) + (20)) / 4 = 27.5

Can I get excel to carry out the calculation in red without me having to restructure my data, I have over 2000 records that I need to do this for. Hence, I'd like to automate it as far as possible. I'm open to using VBA if necessary.

Thanks in advance.
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi. You don't mention the version of excel you are using but I believe the function below was available from 2007 onwards. You will have to change the cell refs and you can use cell refs instead of the dates ive manually typed if you want.

=AVERAGEIFS(B2:B10,A2:A10,">="&"28/02/2015",A2:A10,"<="&"03/03/2015")
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,847
Members
449,194
Latest member
HellScout

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