Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Need Excel solution - mnthy rtrns using "Modified Dietz"

I need a Excel solution to cazluclating monthly returns using "Modifed
Dietz". Has anyone done this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 857
Default Need Excel solution - mnthy rtrns using "Modified Dietz"

Hi,

You can do that in the spreadsheet but its probably easier with a custom VBA
function:

Public Function MDIETZ(dStartValue As Double, dEndValue As Double, iPeriod
As Integer, rCash As Range, rDays As Range) As Double

'Jelle-Jeroen Lamkamp 10 Jan 2008
Dim i As Integer: Dim Cash() As Double: Dim Days() As Integer
Dim Cell As Range: Dim SumCash As Double: Dim TempSum As Double

'Some error trapping
If rCash.Cells.Count < rDays.Cells.Count Then MDIETZ =
CVErr(xlErrValue): Exit Function
If Application.WorksheetFunction.Max(rDays) iPeriod Then MDIETZ =
CVErr(xlErrValue): Exit Function

ReDim Cash(rCash.Cells.Count - 1)
ReDim Days(rDays.Cells.Count - 1)

i = 0
For Each Cell In rCash
Cash(i) = Cell.Value: i = i + 1
Next Cell

i = 0
For Each Cell In rDays
Days(i) = Cell.Value: i = i + 1
Next Cell

SumCash = Application.WorksheetFunction.Sum(rCash)

TempSum = 0
For i = 0 To (rCash.Cells.Count - 1)
TempSum = TempSum + (((iPeriod - Days(i)) / iPeriod) * Cash(i))
Next i

MDIETZ = (dEndValue - dStartValue - SumCash) / (dStartValue + TempSum)

End Function

Note: I do not take credit for this code.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"npappous" wrote:

I need a Excel solution to cazluclating monthly returns using "Modifed
Dietz". Has anyone done this?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"last modified" timestamp function in excel 2003 veek New Users to Excel 6 July 26th 08 05:13 AM
How do I display the most recent "modified" date in Excel sheets? Curious Cat Excel Worksheet Functions 5 October 29th 07 01:59 AM
Solution "Your changes could not be saved" "The document may be read-only or encrypted" [email protected] Excel Discussion (Misc queries) 0 August 7th 06 06:31 AM
any solution to the "too many cell formats error" in excel? Mini Excel Discussion (Misc queries) 1 May 31st 06 11:45 AM
modified dietz method Bonnie Excel Discussion (Misc queries) 0 January 21st 05 05:37 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"