Calculating monthly returns

gcefaloni

Board Regular
Joined
Mar 15, 2016
Messages
119
Hi,

I'm trying to calculate monthly returns from daily returns using geometric mean. I would like to be able to check the date array in column A of the attached document and locate the corresponding return array if the month and the year of the dates in question are equal to the month's returns I'm trying to calculate. My guess is I would need to use an offset function where the reference point changes every month to the first of the month in question and then calculate the height of the offset range based on how many return data points I have for that month.

Not exactly sure how to build this formula out though.

This is the formula I have to replace:
B4:B23 would need to be replaced by the moving offset function for every month in question.
=PRODUCT((1+B4:B23)^(1/n))-1

I have uploaded a sample file here if you want to play around with it: https://file.io/jTEaYH

Essentially, the formulas in E3 and E4 deal with the date filtering fine but they aren't calculating geometric means, it's just a normal sum. I want to incorporate the date filtering within the formula in G3 (=PRODUCT((1+B4:B23)^(1/n))-1).

Also, the hard part is to make it so that the offset function recognizes what is the first day of every month, makes that cell the reference cell, then sees what is the last date of the month in question (even if the current month isn't finished) and then creates the appropriate range of returns between the first and last day of the month in question.

THanks a ton for any help! Or if you can think of any other way of doing this, it would be super appreciated.
 

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
[TABLE="width: 589"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD="align: right"]1000000[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"]Monthly Returns[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Date[/TD]
[TD]Daily Change %[/TD]
[TD][/TD]
[TD="align: right"]Jan-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]31-Jan-19[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]Feb-19[/TD]
[TD="align: right"]0.19118%[/TD]
[TD][/TD]
[TD="align: right"]0.188429%[/TD]
[/TR]
[TR]
[TD="align: right"]01-Feb-19[/TD]
[TD="align: right"]-0.027%[/TD]
[TD][/TD]
[TD="align: right"]Mar-19[/TD]
[TD="align: right"]0.39181%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]04-Feb-19[/TD]
[TD="align: right"]-0.252%[/TD]
[TD][/TD]
[TD="align: right"]Apr-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]05-Feb-19[/TD]
[TD="align: right"]0.193%[/TD]
[TD][/TD]
[TD="align: right"]May-19[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.00000%[/TD]
[/TR]
[TR]
[TD="align: right"]06-Feb-19[/TD]
[TD="align: right"]0.010%[/TD]
[TD][/TD]
[TD="align: right"]Jun-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]07-Feb-19[/TD]
[TD="align: right"]0.261%[/TD]
[TD][/TD]
[TD="align: right"]Jul-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]08-Feb-19[/TD]
[TD="align: right"]-0.020%[/TD]
[TD][/TD]
[TD="align: right"]Aug-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]11-Feb-19[/TD]
[TD="align: right"]-0.079%[/TD]
[TD][/TD]
[TD="align: right"]Sep-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]12-Feb-19[/TD]
[TD="align: right"]-0.061%[/TD]
[TD][/TD]
[TD="align: right"]Oct-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]13-Feb-19[/TD]
[TD="align: right"]-0.012%[/TD]
[TD][/TD]
[TD="align: right"]Nov-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]14-Feb-19[/TD]
[TD="align: right"]0.365%[/TD]
[TD][/TD]
[TD="align: right"]Dec-19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]15-Feb-19[/TD]
[TD="align: right"]-0.056%[/TD]
[TD][/TD]
[TD="align: right"]Jan-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]18-Feb-19[/TD]
[TD="align: right"]0.027%[/TD]
[TD][/TD]
[TD="align: right"]Feb-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]19-Feb-19[/TD]
[TD="align: right"]0.059%[/TD]
[TD][/TD]
[TD="align: right"]Mar-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]20-Feb-19[/TD]
[TD="align: right"]-0.033%[/TD]
[TD][/TD]
[TD="align: right"]Apr-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]21-Feb-19[/TD]
[TD="align: right"]-0.170%[/TD]
[TD][/TD]
[TD="align: right"]May-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]22-Feb-19[/TD]
[TD="align: right"]0.224%[/TD]
[TD][/TD]
[TD="align: right"]Jun-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]25-Feb-19[/TD]
[TD="align: right"]0.077%[/TD]
[TD][/TD]
[TD="align: right"]Jul-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]26-Feb-19[/TD]
[TD="align: right"]0.194%[/TD]
[TD][/TD]
[TD="align: right"]Aug-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]27-Feb-19[/TD]
[TD="align: right"]-0.330%[/TD]
[TD][/TD]
[TD="align: right"]Sep-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]28-Feb-19[/TD]
[TD="align: right"]-0.180%[/TD]
[TD][/TD]
[TD="align: right"]Oct-20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]01-Mar-19[/TD]
[TD="align: right"]0.161%[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]04-Mar-19[/TD]
[TD="align: right"]0.231%[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


This is what the table looks like in the file in case you don't want to download it.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
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