- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
186 lines
16 KiB
Plaintext
186 lines
16 KiB
Plaintext
Episode: 1585
|
|
Title: HPR1585: 36 - LibreOffice Calc - Financial Functions - Loan Payments
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1585/hpr1585.mp3
|
|
Transcribed: 2025-10-18 05:22:13
|
|
|
|
---
|
|
|
|
This episode of HBR is brought to you by AnanasThost.com.
|
|
Get 15% discount on all shared hosting with the offer code HBR15.
|
|
That's HBR15.
|
|
Better web hosting that's honest and fair at AnanasThost.com.
|
|
Hello, this is Ahuka, welcoming you to Hacker Public Radio and another
|
|
exciting episode in our ongoing series on LibreOfficeCount.
|
|
What I'm going to do today is I'm going to get into financial functions.
|
|
Last time we looked at all the different kinds of functions available but we
|
|
got to have to really demonstrate a little bit about how to use some of these
|
|
things. What I want to do is get into financial functions
|
|
probably this and the next episode. Then do maybe a few on statistical functions.
|
|
I don't think I'm going to delve into every single function.
|
|
The idea that I want to get across to you is that once you get comfortable working with functions,
|
|
you can explore the rest of them on your own. There's a huge number of functions available
|
|
and many of them you may not be interested in. So I'm going to try and pick some that I think
|
|
might have some interest at least and show you how to use those and maybe with those tools,
|
|
you'll be able to delve into others if you have specialized needs and want them.
|
|
So for this one, financial functions, I'm going to look at something involving loan payments
|
|
because that's one of those things most of us end up having to deal with one way or another.
|
|
Now, when we first introduced the topic of spreadsheets, we said that spreadsheets was the killer app
|
|
that led to the widespread adoption of PCs and companies. And the reason for that was that you
|
|
could do sophisticated financial analysis with spreadsheets. So it should not come as any great
|
|
surprise that there are many wonderful financial functions in Calc. The thing that you need to
|
|
bear in mind about these is that they're all oriented to doing financial analysis on investments.
|
|
But if you take the time to understand what these functions are doing, you can often use them in
|
|
other ways. And I'm going to show you how. As we pointed out, all functions in Calc take arguments.
|
|
And in this case, you might expect the arguments would have to do with interest rates,
|
|
principal amounts, time periods, payment amounts, and that sort of thing.
|
|
The general form of such a function ties all of these together in a relationship that let you
|
|
specify all but one of them and then solve for the remaining one. Here's an example, courtesy
|
|
of a site called WikiHow.com, which does offer their material under a creative commons license.
|
|
So I am satisfying the terms of the license by telling you where I got it. And in fact,
|
|
the link will be in the show notes. Looks like a good site. You might find some other things you like
|
|
there. So here's the function m equals p times open parentheses j divided by open parentheses
|
|
again, one minus open parentheses a third time, one plus j closed parentheses raised to the power
|
|
of minus n closed parentheses closed parentheses. Well, that was certainly very clear, wasn't it?
|
|
So what are these? m is the monthly payment, p is the principal amount of the loan,
|
|
j is the monthly interest, which is the annual interest divided by 12 and then to take it from an
|
|
interest to a decimal divide by 100. It doesn't matter which order you do those, divide and then divide.
|
|
What is that commutative, I think, or transitive or something? That's been used since I had to learn all of that stuff.
|
|
So what's going on here? Basically, you borrow some amount p, which you need to repay.
|
|
And you will make payments for n number of months. But you cannot simply divide p by n to get
|
|
your monthly payment, because you also need to pay interest on the loan. Interest is usually given
|
|
as an annual percentage, such as 8% per year. To use this in a calculation, you need to convert
|
|
the percentage into a decimal, and that means dividing by 100 to get 0.08.
|
|
But generally, you don't pay interest once a year, you pay it every month in your payments.
|
|
So the last adjustment is to divide by 12 to get 12 monthly payments. Now, having said this,
|
|
the calculation we're about to do may not exactly match what your bank calculates.
|
|
It depends on compounding, and banks are very ingenious at finding ways to have one number that says
|
|
this is what we're charging, and somehow turn it into something that gets them even more.
|
|
I'm not going to dig into it, because this is a tutorial on CALC. It's not a course in advanced finance.
|
|
So once you have this formula, you can do a simple model in a spreadsheet, where if you plug in any
|
|
three of the variables, you can calculate the fourth one. For example, suppose the car dealer makes
|
|
you an offer. You can either get $1,000 off on the price of the car, or get a half a percent
|
|
lower interest rate, which is the better offer. Well, let's put in some actual numbers and do a
|
|
calculation here. Suppose the car you're looking at normally sells for $19,000. You are looking at a
|
|
four-year loan, and the normal interest rate on these loans is 8%. You can put this into a spreadsheet
|
|
and do a quick calculation. I set up one of these on a sample spreadsheet like this. First, I selected
|
|
sales A1 through C1. I click on the merge and center sales button on the formatting bar.
|
|
Now, this is the one that's just to the right of the left align center, right align and justify,
|
|
and as the name suggests, when you click the merge and center sales button, it merges the
|
|
sales and then centers whatever you put in. So I type in manual model, make it bold and increase
|
|
the font size to aerial 12. This is just putting a little header on the stuff that I'm going to do.
|
|
Just to make it a little easier to to read, I'm going to right-click on that, select format
|
|
sales background and give it a nice blue background. It's not strictly necessary,
|
|
but it makes the spreadsheet a little more attractive and I think it's just a little bit easier to
|
|
read and that's not a bad thing. Okay, so I got my header set up and that's on the first row.
|
|
Then in cell A2, I type price of car and in cell B2, I type 19,000.
|
|
In cell A3, I type periods and in cell B3, I type 48. This represents a four-year loan with 48 monthly payments.
|
|
In cell A4, I type interest rate and in cell B4, I type 0.08.
|
|
Now, because the interest rate is given as an annual rate and I want to do monthly payments,
|
|
I'm going to do an intermediate calculation. In cell A5, I type monthly interest rate and in cell
|
|
B5, I type B4 divided by 12. Now, this is the raw material for my calculations.
|
|
The variable I left out is the monthly payment and that's what I would solve for.
|
|
Now, in cell A7, I type base case, then I skip a line because I'm going to do some comparisons.
|
|
In cell A9, I type scenario A and then in cell A10, I type 1000 off the price.
|
|
I drop down a little bit and in cell A13, I type scenario B and then in cell A14, I type 0.005 reduction in rate.
|
|
Now, that is half a percent because I have to remember I have to divide by 100 to get the decimal
|
|
equivalent of half a percent. Then in column C, I will put my answers. So in cell C2, I type to
|
|
monthly payment. Now, I'm going to use my math skills. In cell C7, opposite base case, I put
|
|
in my formula, replacing the variable names in the above formula with cell addresses. So now the
|
|
formula reads B2 times open parentheses, B5 divided by open parentheses, 1 minus open parentheses,
|
|
1 plus B5, closed parentheses, raised to the power of minus B3, closed parentheses, closed parentheses.
|
|
Now, this is really the same thing as the formula that I gave you before with m and p and j and n.
|
|
That's fine. That's exactly what I'm trying to do. So I simply replace those with cell addresses
|
|
of cells that have that data in it. Now, I haven't actually put in any scenario adjustments,
|
|
and that's fine because what I'll do is I'll copy the formula exactly and put it into cell C10
|
|
for my first scenario and then in cell C14 for my second scenario. So I click on C7,
|
|
go to the formula bar, highlight the formula and then copy it, then go to cell C10, click on it and
|
|
paste, do the same thing for cell C14. So now I have the same number in all three of these cells.
|
|
It is the monthly payment if you borrow 19,000 at 8% annual interest for 48 months,
|
|
and it comes to $463.85. But I need to adjust for my scenarios, which I have not done
|
|
yet. So now I go back to cell C10, click on it and edit the formula.
|
|
The scenario is reducing the price of the car by 1,000. Since the price is in cell B2,
|
|
I can replace B2 in my formula with open parentheses, B2 minus 1,000 close parentheses.
|
|
Note that the parentheses are very important here. If you want to calculate the reduced amount
|
|
borrowed, you want to do that before you do the multiplication. Leave that out, you get a very
|
|
bad answer indeed, but do it right and you should get $439.43. So in rough terms you knock 24
|
|
bucks a month off the payment. Now what about the second scenario? That was reducing the annual
|
|
interest rate by .05. But again, I need to get this in monthly terms, and that means dividing by
|
|
12. So again, I'm going to do an intermediate calculation. In cell A15, I type monthly interest
|
|
in cell B15, I type equals open parentheses B4 minus .005 close parentheses divided by 12.
|
|
Again, make sure you put the parentheses around that B4 minus .005 because you need to do that
|
|
calculation before you do the division. Now, in my formula in cell C14, I make the adjustment
|
|
by replacing every instance of B5, the old interest rate number, with B15, my new number.
|
|
So now my formula reads equals B2 multiplied by open parentheses B15 divided by
|
|
open parentheses 1 minus open parentheses 1 plus B15 close parentheses raised to the power
|
|
of minus B3 close parentheses close parentheses. And my new monthly
|
|
of payment appears to be $459.40. So I would be better off taking the $1,000 discount instead of
|
|
the interest rate reduction in this particular case. Now, this is probably seems a little
|
|
bit complicated, fairly difficult to do if you're not used to doing financial calculations,
|
|
so wouldn't it be nice if you could do the same thing with a built-in function? And you can.
|
|
There is a financial function called PMT that handles this very nicely.
|
|
But note, you need to have gathered the same information we used above for our manual calculation.
|
|
The PMT function has these arguments. First one is rate. Well, that's what we had above for
|
|
our interest rate, but it should be the annual rate divided by 12 to get the monthly rate,
|
|
not just the annual rate. NPR stands for number of periods, which in our example is 48.
|
|
PV is the present value, which in this case is the amount you borrowed. In other words,
|
|
19,000. FV is the future value, which we're going to assume you pay off everything you borrow,
|
|
so at the end it should be zero. Then there's something called type, which is optional.
|
|
A variable that specifies when the payment occurs each month. If you enter zero or leave it blank,
|
|
it is assumed to be the end of the month. If you enter a one, it means your payment is at the
|
|
beginning of the month. The difference is slight in either case.
|
|
So, I added another section to my sheet to show what happens if I use the built-in formula.
|
|
To do this, you begin by clicking on the cell where you want the formula to be calculated,
|
|
then go to the function key and select it.
|
|
Select financial in the category drop-down, then scroll down to PMT. Select it and click next.
|
|
This will bring up a window on the right with fields for each of your variables.
|
|
Now, you could type in numbers, but that is not the way to do it. I keep telling you,
|
|
cell addresses is the way to go. So, to grab the cell addresses, we click on the field to put our
|
|
insertion mark there, then click on the cell, and it will be added to the field.
|
|
So, to do a comparison, I go to cells A18 through C18,
|
|
click the merge and center cell button, apply font styles and background as before,
|
|
but now I'm going to call it using the PMT formula. So, that's the header for this section.
|
|
So, in cell A20, I type base case, in cell A22, I type scenario A, in cell A24, I type scenario B.
|
|
Then, in cell C20, I click on the function when wizard, select the PMT function and fill it out
|
|
using the numbers we got earlier. Rate, that's cell B5, N per cell B3. FV is cell B2.
|
|
PV, I'm sorry, is cell B2. FV is left blank, which means it's assumed to be zero.
|
|
In other words, the loan will be completely paid off.
|
|
Then, for scenario A, rate is B5, N per is B3. Present value, cell B2 minus 1000.
|
|
FV is still blank. For scenario B,
|
|
rate is cell B15 now, N per, number of periods, that's still cell B3. Present value is cell B2.
|
|
Future value, left blank. And when you do that, what numbers do you get?
|
|
For the base case, $463.85. For scenario A, $439.43.
|
|
And scenario B, $459.40.
|
|
And these are exactly the numbers we got previously, or almost so. There is one difference.
|
|
They're reported as negative numbers. But that only means that they are money being paid out
|
|
rather than money coming in. Remember, we're using a function used to evaluate investments
|
|
and just turn it around. So, don't worry about those minus signs. As long as you understand what
|
|
you're doing, don't worry about it. So, lessons learned. The formula we use to do the manual
|
|
calculation is obviously the exact same formula that Calc used to get these monthly payment numbers.
|
|
I went through this exercise in part to demonstrate that idea and to give you some sense of
|
|
what is going on behind the scenes when you use a formula. I probably won't do it again,
|
|
but I thought it was worth doing once. The first step in using a formula is to look at the arguments
|
|
it requires, and make sure you have them ready to hand. If you are not sure what each variable really
|
|
means, do a little Google research. One thing that may help is that in the cases I have investigated
|
|
so far, the Calc functions and the Excel functions are identical. You may find it easier to get a
|
|
good explanation off an Excel help site. If so, use it. You don't get bonus points for avoiding
|
|
the best information. And the last one. I did intermediate calculations several times in my
|
|
example. Well, these are not strictly necessary, but they are usually a good idea. I could have made
|
|
my formulas even more complicated by adding the adjust terms into them directly. But the problem is
|
|
your formulas quickly become almost impossible to debug that way. A good intermediate calculation
|
|
lets you move some of that outside the formula, and you can usually do a quick sanity check to see
|
|
if the number you get is plausible. For instance, if you divided by 12, did the answer look like
|
|
112 to what you started with? Okay, so I did all of this on a spreadsheet. I have uploaded it to my
|
|
website. You can download it. Take a look at it. I encourage you to do that. And see if you can follow
|
|
along with the things that I did. I understand that this can be a little tricky to do in audio.
|
|
And so check the show notes and everything will be there. So for now, this is Ahuka
|
|
signing off for Hacker Public Radio. Reminding everyone to support free software. Good bye.
|
|
You've been listening to Hacker Public Radio at Hacker Public Radio dot org.
|
|
We are a community podcast network that releases shows every weekday, Monday through Friday.
|
|
Today's show, like all our shows, was contributed by an HBR listener like yourself.
|
|
If you ever thought of recording a podcast, then click on our contributing to find out how easy it
|
|
really is. Hacker Public Radio was founded by the digital dog pound and the infonomicon computer club,
|
|
and is part of the binary revolution at binrev.com. If you have comments on today's show,
|
|
please email the host directly, leave a comment on the website or record a follow-up episode yourself.
|
|
Unless otherwise stated, today's show is released on the creative comments,
|
|
attribution, share a light, free dot org license.
|