Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If I use 03/01/05 as the start date the function works. However, if I
use 02/01/05 or 01/01/05 I get #Value! What am I missing? stan Public Function TRM(compYear As Integer, sDate As Date, numUnits As Integer, trans As Currency) As Double Const yearAmt = 36000 Const monthAmt = 3000 Const PRN = 2 Dim tAmt As Currency Dim calcYear As Integer calcYear = Year(sDate) Dim eDate As Date eDate = CDate("12/31/" & CStr(calcYear)) Dim pAmt As Currency Dim AllAmt As Currency Dim numMonths As Integer numMonths = CInt(DateDiff("m", sDate, eDate)) + 1 tAmt = numMonths * monthAmt If compYear = calcYear Then pAmt = numUnits * tAmt Else pAmt = yearAmt * numUnits End If If trans < pAmt Then TRM = 0 Else TRM = (trans - pAmt) * PRN End If End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I need a february 29th row, but only if the day of year actually exists | Excel Worksheet Functions | |||
calculating due dates and february differences | Excel Discussion (Misc queries) | |||
Date plus 1 year (february problem) | Excel Worksheet Functions | |||
When February 29 is date? | Excel Worksheet Functions | |||
using date function, month shows as January when i type (12) | Excel Discussion (Misc queries) |