Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why does My Macro Function give error: Inadmissible value or data type. Index out of defined range.

Function INFLATION_ADJUSTED(optional x(),optional y(),optional AMT) as double REM predicts the amount adjusted for inflation dim Amplitude as double dim Delta as double dim H as double dim V as double dim Period as double dim r as double dim Inflation_Rate as double

Delta = ((y(1,1)-y(0,1)))
Amplitude = scr(y(0,1)^2 - Delta^2)
Period = PI()/UBound(x)
H = ASIN(y(0,1)/Period)
V = 0

For n = 0 to x
    V = V + y(n,1)/UBound(x)
Next n

For i = 0 to UBound(x)
    Inflation_Rate = (Amplitude*SIN(Period*(i)+H)+V)
    r = AMT*(1-Inflation_Rate/100)
Next i

INFLATION_ADJUSTED = r

End Function

Why does My Macro Function give error: Inadmissible value or data type. Index out of defined range.

Function INFLATION_ADJUSTED(optional x(),optional y(),optional AMT) AMT, optioanal Future_Year) as double REM predicts the amount adjusted for inflation dim Amplitude as double dim Delta as double dim H as double dim V as double dim Period as double dim r as double dim Inflation_Rate as double

Delta = ((y(1,1)-y(0,1)))
Amplitude = scr(y(0,1)^2 - Delta^2)
Period = PI()/UBound(x)
H = ASIN(y(0,1)/Period)
V = 0

For n = 0 to x
    V = V + y(n,1)/UBound(x)
Next n

For i = 0 to UBound(x)
Future_Year
    Inflation_Rate = (Amplitude*SIN(Period*(i)+H)+V)
    r = AMT*(1-Inflation_Rate/100)
Next i

INFLATION_ADJUSTED = r

End Function

click to hide/show revision 3
None

Why does My Macro Function give error: Inadmissible value or data type. Index out of defined range.

Function INFLATION_ADJUSTED(optional x(),optional y(),optional AMT, optioanal Future_Year) as double REM predicts the amount adjusted for inflation dim Amplitude as double dim Delta as double dim H as double dim V as double dim Period as double dim r as double dim Inflation_Rate as double

Delta = ((y(1,1)-y(0,1)))
Amplitude = scr(y(0,1)^2 - Delta^2)
Period = PI()/UBound(x)
H = ASIN(y(0,1)/Period)
V = 0

For n = 0 to x
    V = V + y(n,1)/UBound(x)
Next n

For i = 0 to Future_Year
    Inflation_Rate = (Amplitude*SIN(Period*(i)+H)+V)
    r = AMT*(1-Inflation_Rate/100)
Next i

INFLATION_ADJUSTED = r
End Function

End Function

click to hide/show revision 4
None

Why does My Macro Function give error: Inadmissible value or data type. Index out of defined range.

Function INFLATION_ADJUSTED(optional x(),optional y(),optional AMT, optioanal Future_Year) as double REM predicts the amount adjusted for inflation dim Amplitude as double dim Delta as double dim H as double dim V as double dim Period as double dim r as double dim Inflation_Rate as double

Delta = ((y(1,1)-y(0,1)))
Amplitude = scr(y(0,1)^2 - Delta^2)
Period = PI()/UBound(x)
H = ASIN(y(0,1)/Period)
V = 0

For n = 0 to x
    V = V + y(n,1)/UBound(x)
Next n

For i = 0 to Future_Year
    Inflation_Rate = (Amplitude*SIN(Period*(i)+H)+V)
    r = AMT*(1-Inflation_Rate/100)
Next i

INFLATION_ADJUSTED = r
End Function
click to hide/show revision 5
None

Why does My Macro Function give error: Inadmissible value or data type. Index out of defined range.

Function INFLATION_ADJUSTED(optional x(),optional y(),optional AMT, optioanal Future_Year) as double REM predicts the amount adjusted for inflation dim Amplitude as double dim Delta as double dim H as double dim V as double dim Period as double dim r as double dim Inflation_Rate as double

 Delta = ((y(1,1)-y(0,1)))
 Amplitude = scr(y(0,1)^2 - Delta^2)
 Period = PI()/UBound(x)
 H = ASIN(y(0,1)/Period)
 V = 0

 For n = 0 to x
     V = V + y(n,1)/UBound(x)
 Next n

 For i = 0 to Future_Year
     Inflation_Rate = (Amplitude*SIN(Period*(i)+H)+V)
     r = AMT*(1-Inflation_Rate/100)
 Next i

 INFLATION_ADJUSTED = r
End Function
click to hide/show revision 6
None

Why does My Macro Function give error: Inadmissible value or data type. Index out of defined range.

Edited by @Ratslinger for clarity:

Function INFLATION_ADJUSTED(optional x(),optional y(),optional AMT, optioanal Future_Year) as double
        REM predicts the amount adjusted for inflation
        dim Amplitude as double
        dim Delta as double
        dim H as double
        dim V as double 
        dim Period as double 
        dim r as double
        dim Inflation_Rate as double

double

        Delta = ((y(1,1)-y(0,1)))
     Amplitude = scr(y(0,1)^2 - Delta^2)
     Period = PI()/UBound(x)
     H = ASIN(y(0,1)/Period)
     V = 0

     For n = 0 to x
         V = V + y(n,1)/UBound(x)
     Next n

     For i = 0 to Future_Year
         Inflation_Rate = (Amplitude*SIN(Period*(i)+H)+V)
         r = AMT*(1-Inflation_Rate/100)
     Next i

     INFLATION_ADJUSTED = r
 End Function