CAGR, why it's not in Excel

krehkop

Board Regular
Joined
Jul 6, 2007
Messages
133
Office Version
  1. 365
Platform
  1. Windows
I'm running Excel 2003 (Windows 2000). I've researched (online) the compound annual growth rate ("CAGR") and there appears to be a =CAGR() function in Excel, however, not in the version I have.

Does anyone know how I can have this function available in my version of excel?

Regards,
Kirk
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Thank you but I don't know how to put the code in a module. Are there modules within Excel or is that person talking about a VBA module? IF VBA, I don't get how that will work...
 
Upvote 0
It may be easier to use the RATE function as in Andrew's suggestion... but, fairwinds was referring to VBA.

Press alt + F11 to bring up VBA, go to insert --> module, paste fairwinds' code, and close out of VBA.

Then, you'd call fairwinds' UDF with =CAGR(A1,A2,A3) where A1 is the starting value, A2 is the ending value, and A3 is the number of periods.

Note that, without application.volatile in the code, the CAGR UDF will not automatically recalculate when you change A1, A2, or A3. Note also that, depending on their security settings, adding macros to your project may cause issues if you distribute the workbook to other people (i.e. you may get phone calls about enabling macros, etc.)
 
Upvote 0
In case you're interested here is a different CAGR UDF where you select the range of cells and ignores blank cells in the range. This way you don't have to count periods and change it if you insert cells somewhere in the string.


Code:
Public Function CAGR(ByVal myRng As Range) As Double

Dim Fst As String
Dim lst As String
Dim pos As Single
Dim Periods As Integer

Application.Volatile
pos = InStr(myRng.Address(False, False), ":")
lst = Mid(myRng.Address(False, False), pos + 1, _
    Len(myRng.Address(False, False)))
Fst = Left(myRng.Address(False, False), pos - 1)

Periods = myRng.Count
For Each cl In myRng
If cl = "" Then
Periods = Periods - 1
End If
Next cl

CAGR = ((Range(lst) / Range(Fst)) ^ (1 / (Periods - 1))) - 1

End Function
 
Upvote 0

Forum statistics

Threads
1,223,629
Messages
6,173,434
Members
452,514
Latest member
cjkelly15

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