Calculating 1 / 3 / 5 year Returns on a table that varies in length.

Mike UK

New Member
Joined
Dec 14, 2011
Messages
43
Hi,
I have a table of monthly performance data where each new month the previous month's performance is annotated. I'm looking to use a formula that calculates the 1, 3, 5 year returns automatically and allows for the fact that the table or performance data increases each month.

This formula works for calculating the returns of the periods using the offset. This is the 1-year calculation

=(PRODUCT(1+(OFFSET('Data'!B131,-11,0,12))/100)-1)*100

However, the row B131 is currently fixed. I need to make the row number a variable that changes each time new data is added to the table
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
And which Office version do you use?

Anyway, try replacing your OFFSET portion of the formula with
VBA Code:
OFFSET(B1,MAX(IF(B1:B1000<>"",ROW(B1:B1000)-1,"")),0,-12,1)
Depending on your Office version, you might need to enter the formula using Contr-Shift-Enter
If you get a #REF! error then try
VBA Code:
OFFSET(B1,-12+MAX(IF(B1:B1000<>"",ROW(B1:B1000),"")),0,12,1)

Both the formulas assumes that you have at least 12 rows of data, or you'll get an error
 
Upvote 1
Solution
And which Office version do you use?

Anyway, try replacing your OFFSET portion of the formula with
VBA Code:
OFFSET(B1,MAX(IF(B1:B1000<>"",ROW(B1:B1000)-1,"")),0,-12,1)
Depending on your Office version, you might need to enter the formula using Contr-Shift-Enter
If you get a #REF! error then try
VBA Code:
OFFSET(B1,-12+MAX(IF(B1:B1000<>"",ROW(B1:B1000),"")),0,12,1)

Both the formulas assumes that you have at least 12 rows of data, or you'll get an error
Thanks Anthony, first solution worked perfectly! 👊
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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