What is wrong with this NPER function usage? - excel

I'm trying understand how NPER works. I used the following arguments:
loan amount: 145750
APR : 0.04
monthly payments : 9950/12
called the NPER with the following to obtain the number of periods in years :
=nper(0,04/12;9950/12;145750;0;1)/12
and it returned -11,51. This cannot be correct since 11,51 * 9950 = 114524,5 which is less than the original loan amount.
What has gone wrong?

NPER is effectively performing a balancing act, say borrowing a lump sum now and repaying it in relatively small installments for 'years' to come - or investing a capital amount now in exchange for a series of relatively small returns for 'years' to come. Either way money goes out and money comes in. =NPR sets the one-off (large) element against the stream of (small) elements and allows for the time value of money.
For this to work, the convention is that what goes out is negative and what comes in is positive, though does work either way around.
However, the two must be of opposite sign.

Related

Value At Risk Calculation with consistently falling prices

My question is twofold:
When calculating value at risk, let's say the price of an asset or portfolio is falling 1% every month for 12 months. If I tried to calculate standard deviation, it will show up as 0 and no meaningful VAR calculation possible. Is there another way to measure VAR that takes into account consistent declines like this?
Can you recommend a source that explains simply how to calculate portfolio VAR in Python?
Thanks you.

Having problems spreading expense over months with partial month calculation

I am writing a nested if statement that will calculate monthly expense based on an "Expense Frequency" option. Most of them see to be working but I have two that will not work for some reason.
The first problem is the "Fixed" option - I want this to put the whole expense rate in the first month of the expense period. For some reason it is not triggering in the first month. I feel like this might be a simple fix?
The second problem is a little more complex. It is the "Spread Amount" option. When the months are full calendar months the calculation is easy, divide total expense amount by # of months. But when I factor in partial months the calculation diverges from what I am looking for. The shorter the time duration, the larger the variance is from the total expense. When I stretch the expense over a longer period the variance shrinks. It is a pretty complex calculation (I think) and basically I want to use days out of the month for the calculation in the partial months (first and/or last) and then whole months in the middle. I have attempted this in my attached spreadsheet and I thought it might work but it isn't. Is anyone able to help me out here? I would even be satisfied with a succinct explanation of why this calculation isn't possible / doesn't make sense / cannot be done so I can explain this to my boss. I am providing a cash reward for this if it can be handled in the next three hours. Please help!! Thank you!
This is my formula
=IF($I9="Spread Amount",IF(AND($J9<=O$6,$K9>=O$5),IF(EOMONTH($J9,0)=O$6,(($M9)/(DATEDIF($J9,$K9,"m")+1)((O$6-$J9+1)/O$4)),IF(EOMONTH($K9,0)=O$6,IF(EOMONTH($K9,0)=O$6,(($M9)/(DATEDIF($J9,$K9,"m")+1)(($K9-O$5+1)/O$4))),($M9-IF(ISERROR(HLOOKUP($K9,$6:9,$XFD9,0)),HLOOKUP(EOMONTH($K9,0),$6:9,$XFD9,0),0)-IF(ISERROR(HLOOKUP($J9,$6:9,$XFD9,0)),HLOOKUP(EOMONTH($J9,0),$6:9,$XFD9,0),0))/(DATEDIF($J9,$K9,"m")))),0),IF(O$7>$K9,0,IF($I9="EOQ",IF(OR(MONTH(O$7)=3,MONTH(O$7)=6,MONTH(O$7)=9,MONTH(O$7)=12),$M9,0),IF($I9="Spread Evenly",IF(AND($J9<=O$6,$K9>=O$5),IF(EOMONTH($J9,0)=O$6,$M9*((O$6-$J9+1)/O$4),IF(EOMONTH($K9,0)=O$6,$M9*(($K9-O$5+1)/O$4),$M9)),IF($I9="Fixed",IF(AND($J9>=O$5,$J9<=O$6),$M9,0),IF($I9="Repeat Annually",IF(MONTH($J9)=MONTH(O$6),$M9,0),0))),IF($I9="Odd Month",IF(ISODD(MONTH(O$6)),$M9,0),IF($I9="Daily",IF(AND($J9<=O$6,$K9>=O$5),IF(EOMONTH($J9,0)=O$6,($M9/($K9-$J9+1))(O$6-$J9+1),IF(EOMONTH($K9,0)=O$6,($M9/($K9-$J9+1))($K9-O$5+1),($M9/($K9-$J9+1))*O$4)),0))))))*1)
This is what the spreadsheet looks like

"IF" function for analysis of hospital lab frequency

I work for a hospital that is part of a larger network. We were recently asked by our corporate overlords to address the use of a specific laboratory test. in general, this test should only be performed daily, which should be considered to corresponded to a 24 hour period from last draw. sometimes, however, based on when people arrive to the hospital (e.g. 7pm), and in the interest of bundling labs for a single draw, they may be drawn sooner to coincide with routine testing i.e. 5am. it would never be necessary to otherwise need to repeat within a short (8 hour) window, particularly on the same day.
we have been asked to validate to see if we are adhering to this general practice, as testing any more frequent than that, say, within 12h of a previous test, has no real clinical value and thus adds unnecessary cost.
To address this issue I was given a dataset that among other items includes all instances the lab was performed including collection date and time.
please see HIPPA-safe example below (to be clear, no real data and identifiers are not real); the actual dataset has over 4,174 entries corresponding to 1,328 unique persons. everyone had at least one test performed, not everyone had >1.
I THINK what I want to do is an IF formula that reads the antecedent cell to 1) check if same person and 2) if so, perform a subtraction of the time stamp to display the relevant difference in time, which I can then filter, create histogram, etc. does this seem like a reasonable approach? is there a more preferable method to facilitate analysis? do any other forms of analysis come to mind?
=IF(B2=B1, D2-D1, "n/a")
example data set with formula:
any other forms of analysis come to mind?
By the looks of it you should consider taking the values under "Results" into account, assuming there is a band that might be considered 'normal' readings. The "one in 24 hours is sufficient" rule of thumb may well be appropriate for a series of values within the 'normal' band but not so much so if readings are close to 'danger level'.
That is, in some cases a higher than 'standard' frequency of monitoring may be in the patient's interest, even if not hospital policy, so it may be worth separating the "less than 24 hours interval" readings into those where the higher frequency provided information of little value (eg readings remaining within a 'normal' band) from any that crossed into or out of the band and/or large changes in value. This though may be more a matter of statistical analysis than programming and depend upon whether any action might be taken as a result of such "extra" readings.

NPER spreadsheet function mystery

I'm trying to use NPER to obtain the number of months required for a 100,000 loan/debt to be reduced to 80,000, when the interest rate is 4% annually and monthly repayments are 10000/12.
I know the answer is 39 months (I've computed it with another method that I trust).
Parametrizing NPER:
=nper(0.04/12,10000/12,-100000,-80000,1)
gives 236.0242766 months, not 39 months as expected.
What is wrong?
The amount borrowed (100k) and the amount still outstanding (80k) need to be of opposite sign. (Similar to before!) In Google Sheets and Excel each should return 37.42.
A little trickier for me to explain than why the loan and the repayments need to be of opposite sign, but the rationale is similar. Maybe think of a hiatus at 37 months. In reality, there is then still 80k outstanding – so this might be the loan amount for a new calculation (perhaps with a revised interest rate or larger/smaller monthly repayments). In such other calculation the 80K would logically have the same sign as the 100k has at present.
But at no time is the100k (or its remainder) outstanding while the 80k (or its remainder) is, hence for the 80k to feature in both calculations netting off between these (one plus and one minus) makes sense to me (leaving the borrowed amount as 100k in total).
Or consider that after 37 months it is though the 80k is paid back (opposite sign to borrowed) and a fresh borrowing of 80k starts.

calculating rate of return from PV, FV, and monthly contribution

I'm trying to figure out what rate of return I would need on an investment in order to compare to paying down a mortgage.
I have calculated the change in the mortgage - I know how much money I'd save by the end of the loan term and how much money I'd need to put in. I'm trying to compare that to an equivalent investment - treat any lump sum payment as the principal of an investment, treat any monthly overpayment as a monthly contribution to an investment, plug in the final value, and solve for the effective rate of return.
I've looked at the RATE and the IRR commands. IRR seems close to what I want, but it wants a series of values for the input flows, but I have it as a periodic regular investment.
For an example with numbers - if I pay an extra $100 a month on the mortgage for 120 months, I can save $10000 in total cost. What command can I use to calculate this in terms of an investment? If I invest $100 a month for ten years and end up with $10000, what was my annualized rate of return?
If I start with principal PV invested at rate R, I contribute monthly payment M for N months, and I end up with final value FV at the end of those N months, I'd like to solve for R given the other variables.
I know there's another factor regarding the mortgage interesting being tax deductible - I'll look at worrying about that after I figure this part out.
:)
Your monthly return is given by this RATE formula
number of periods = 120 (10*12)
contributions of $100 per period
future value of 10,0000
=RATE(10*12,-100,0,10000)
=-0.32% per month
Note as a check =RATE(10*12,-100,0,12000) = 0
which is equivalent to an annual rate of
=1-(1-0.32%)^12
=-3.73%

Resources