Thousands of Clydesdale Bank mortgage customers will have some of their debt written off or be given compensation as part of a £33 million redress package, after the firm miscalculated their repayments.

The bank has also been fined an extra £8.9 million by the regulator, the Financial Conduct Authority, after it investigated the gaffe which affected 42,500 mortgage holders between 2008 and 2010.

The miscalculations meant some people on variable rate mortgages were underpaying, while a few were overpaying. No-one on a fixed rate was affected.

This all happened around the time the base rate was dropping, so monthly payments were regularly changing, making it difficult for borrowers to know their payments were incorrect.

The issues first came to light in 2010. Clydesdale recognised the problem then, but the FCA says it put it commercial needs ahead of those of its customers by demanding those originally undercharged increase their payments to get back up to date, with little regard to whether they could afford it.

I underpaid, what happened and what compensation will I get?

Of the 42,500 affected, the vast majority would have underpaid. As an example, the bank charged some mortgage holders too little each month. So if their payment should have been £1,000 a month, they may have been charged £950 instead.

This left 22,000 with shortfalls, meaning when they came to the end of their mortgages, they would have owed the bank money when the debt should have been paid off.

However, Clydesdale tried to bring the mortgages up to date by hitting customers with unexpected increases in monthly repayments. It sought to recoup the shortfalls by increasing payments by up to £3,500 a year.

Anyone in this position will have the shortfall at the time the error was spotted written off. Shortfalls range from £20 to £18,000, at an average of £970. If you had a shortfall then but have since paid off your loan, you will still get the money back.

In addition, customers made to increase payments to bring them up to date can also claim if the additional payments put them into financial difficulty. They would be entitled to get any charges incurred as a result back, such as overdraft fees.

The majority of the remaining 20,500 customers would also have been charged too little but this was masked by the fact they voluntarily decided to overpay their mortgage. Again, disregarding what they overpaid, whatever the shortfall was, they'll get back.

I overpaid, what happened and what compensation will I get?

While this only affected a small percentage of the 42,500, overpayments happened where payments were set too high.

This would never have meant mortgage holders paid more than the total debt, just that they would have paid it back too quickly.

Those who overpaid won't get any compensation. Instead, they can claim the additional cash they paid back, but this would mean they still owe that money.

So if you overpaid by £1,000 in total and still owe £100,000 of your loan, if you choose to get the £1,000 back, you'll then owe £101,000.

Therefore, a refund may help your short-term cash flow, but you'll be charged more interest overall.

How do I get compensation?

Clydesdale says it will write to all customers affected by mid-October, so get a claim in if you get this letter. Even if you've since paid off your mortgage, compensation is still possible.

If you believe your payments were miscalculated and you are owed cash, and don't receive a letter, then get in touch with Clydesdale. If you've moved home recently, you may be in this boat.

Clydesdale chief executive David Thorburn says: "I am very sorry that this wasn't handled as it should have been. We should have made it clear at the time that this was entirely our fault and that some customers may be entitled to compensation.