Dim x as variant temp as double i as integer dim

This preview shows 6 out of 11 pages.

Dim X As Variant, Temp As Double, i As Integer Dim IsRow As Boolean X = CF: Temp = 0 If IsArray(X) Then If UBound(X) = 1 Then IsRow = True Else IsRow = False If IsRow Then For i = 1 To UBound(X, 2) Temp = (Temp + X(1, i)) * 1.05 Next i Else For i = 1 To UBound(X) Temp = (Temp + X(i, 1)) * 1.05 Next i End If Else Temp = X * 1.05 End If RCMyFV = Temp End Function G 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Image of page 6

Subscribe to view the full document.

MyFV in Action PositiveR 5% 100 100 100 ### NegativeR 10% -100 -100 -100 ### -100 100 100 ### #MACRO? <-- =MyFV(C3:C5,$B$3,$B$4 A B C D E F 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
Image of page 7
<-- =MyFV(C3:E3,$B$3,$B$4) <-- =MyFV(C4:E4,$B$3,$B$4) <-- =MyFV(C5:E5,$B$3,$B$4) 4) Function MyFV(CF As Variant, PositiveR As Double, _ NegativeR As Double) As Double Dim X As Variant, Temp As Double, i As Integer Dim R As Double, IsRow As Boolean X = CF: Temp = 0 If IsArray(X) Then If UBound(X) = 1 Then IsRow = True Else IsRow = False If IsRow Then For i = 1 To UBound(X, 2) If X(1, i) < 0 Then R = NegativeR _ Else R = PositiveR Temp = (Temp + X(1, i)) * (1 + R) Next i Else For i = 1 To UBound(X) If X(i, 1) < 0 Then R = NegativeR _ Else R = PositiveR Temp = (Temp + X(i, 1)) * (1 + R) Next i End If Else If X < 0 Then R = NegativeR Else R = PositiveR Temp = X * (1 + R) End If MyFV = Temp End Function G 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
Image of page 8

Subscribe to view the full document.

BankPv 100 100 100 ### <-- =BankPv(A3:C3,0.1) 100 100 ### <-- =BankPv(A3:A5,0.1) 500 500 100 ### <-- =BankPv(A9:C9,0.1) 100 500 ### <-- =BankPv(A9:A11,0.1) A B C D E F G 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
Image of page 9
Function BankPV(CF As Variant, R As Double) As Double Dim X As Variant, Temp As Double, i As Integer Dim IsRow As Boolean X = CF: Temp = 0 If IsArray(X) Then If UBound(X) = 1 Then IsRow = True Else IsRow = False If IsRow Then For i = 1 To UBound(X, 2) Temp = Temp + X(1, i) / (1 + GetR(R, X(1, i))) ^ i Next i
Image of page 10

Subscribe to view the full document.

Image of page 11
You've reached the end of this preview.
  • Spring '09
  • EDWARDCHANG
  • Harshad number, Prime number, temp

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern