Donate to Remove ads

Got a credit card? use our Credit Card & Finance Calculators

Thanks to lansdown,Wasron,jfgw,Rhyd6,eyeball08, for Donating to support the site

Excel Tax Calculator with Capital Gains?

Practical Issues
Rajput1962
Posts: 48
Joined: March 12th, 2018, 5:35 pm
Has thanked: 35 times
Been thanked: 3 times

Excel Tax Calculator with Capital Gains?

#383304

Postby Rajput1962 » February 3rd, 2021, 10:58 am

Hello All.

I stumbled across this previous topic viewtopic.php?f=49&t=2841&start=60&hilit=excel+tax+calculator which was for 2016-17. However, it doesn't deal with any capital gains tax.

I had decided to create my own spreadsheet for 2019-20 with which i had some moderate success before i found this: https://drive.google.com/open?id=0Bwpa1 ... EpUemQyS2s - many thanks to highriskpaul.

However, my version used too many '=IF' statements within the cells to calculate numbers and eventually i changed a formula somewhere and several steps later it was too difficult to go back :( . Despite several restarts i think i've given up on my approach. highriskpaul's version is so much neater - but it doesn't deal with CGT.

There is speculation in the press about possible changes to CGT perhaps in the next budget. What i'm trying to do is to some 'what-if' scenarios. My income situation has now changed - now early retired for a year with a DB pension to cover outgoings - but i do have additional dividend income. And maybe CGT if i exceed the allowance though i've always stayed within the annual allowances.

What i would like to work out now is how much of a holding >£12300 CGT allowance i could sell before crossing over into a higher tax threshold, even if it means paying extra CGT at 10% taking the annual CGT allowance into account.

I'd like to be able to forecast my potential tax liability for 2020-21 and also 2021-22 and what i could do, if anything, to counter any changes which i might consider as detrimental in the event the Chancellor makes CGT changes. What if say the annual CGT allowance is reduced to only £2000 as has been mooted? My logic is that it would be better to pay extra 10% now than be faced with say 20% on the same in the future and maybe a lower annual allowance.

Dealing with all the variables of income, interest, dividends, and CGT so that they work for all the different combinations and allowances - is very taxing!! :lol:

Any chance of an update to the spreadsheet to include CGT?!! :)

modellingman
Lemon Slice
Posts: 622
Joined: November 4th, 2016, 3:46 pm
Has thanked: 608 times
Been thanked: 368 times

Re: Excel Tax Calculator with Capital Gains?

#383865

Postby modellingman » February 5th, 2021, 2:44 pm

Rajput1962 wrote:Hello All.

I stumbled across this previous topic viewtopic.php?f=49&t=2841&start=60&hilit=excel+tax+calculator which was for 2016-17. However, it doesn't deal with any capital gains tax.

I had decided to create my own spreadsheet for 2019-20 with which i had some moderate success before i found this: https://drive.google.com/open?id=0Bwpa1 ... EpUemQyS2s - many thanks to highriskpaul.

However, my version used too many '=IF' statements within the cells to calculate numbers and eventually i changed a formula somewhere and several steps later it was too difficult to go back :( .



I downloaded and had a look at the Excel workbook on the Google drive link.

One feature of this is that it avoids a lot of =IF() statements by using the =MAX() and =MIN() functions. Although both these functions can have many values (or "arguments") within the brackets, in this workbook they only ever use 2.

As I am sure you are aware =MIN(a,b) is just a slightly more concise way of writing =IF(a<b,a,b).

Where it gets a bit more difficult is that quite a few cells use formulae which combine the two functions as =MIN(MAX(a,b),c) and =MAX(MIN(a,c),b).

These two are actually equivalent and effectively constrain a variable a (such as income) to be between two thresholds b (lower) and c (upper).

Examples include:

Cell B41 [=MIN(MAX((B38-B6)/2,0),B5)], here a is the reduction in personal allowance of £1 for every £2 of income [cell B38] above the income limit for personal allowance [cell B6]. The lower threshold b is 0 and the upper threshold c is the standard personal allowance [cell B5].

Cell G51 [=MAX(MIN(B28-B42,B43),0)], here a is the non-savings and non-dividend income [cell B28] in excess of the (adjusted) personal allowance [cell B42] allocated to the basic rate band. This is constrained to be between the lower threshold b of 0 and the adjusted upper threshold of this band c given by cell B43.

Cell G51 could equally be expressed as =MIN(MAX(B28-B42,0),B43)

Possibly like yourself, I found the =MIN(MAX(a,b),c) and =MAX(MIN(a,c),b) constructs a little puzzling at first and it was only when I realised the above that I appreciated why the author (hiriskpaul) had done it this way. In fact, as far as I can see, the author has made the task of understanding the formulae easier by always putting the variable amount a as the first argument within the =MIN() and =MAX() functions.

Rajput1962 wrote:There is speculation in the press about possible changes to CGT perhaps in the next budget. What i'm trying to do is to some 'what-if' scenarios. My income situation has now changed - now early retired for a year with a DB pension to cover outgoings - but i do have additional dividend income. And maybe CGT if i exceed the allowance though i've always stayed within the annual allowances.

What i would like to work out now is how much of a holding >£12300 CGT allowance i could sell before crossing over into a higher tax threshold, even if it means paying extra CGT at 10% taking the annual CGT allowance into account.

I'd like to be able to forecast my potential tax liability for 2020-21 and also 2021-22 and what i could do, if anything, to counter any changes which i might consider as detrimental in the event the Chancellor makes CGT changes. What if say the annual CGT allowance is reduced to only £2000 as has been mooted? My logic is that it would be better to pay extra 10% now than be faced with say 20% on the same in the future and maybe a lower annual allowance.

Dealing with all the variables of income, interest, dividends, and CGT so that they work for all the different combinations and allowances - is very taxing!!

Any chance of an update to the spreadsheet to include CGT?!!


The basic CGT rules as, I'm sure you will know, can be found here: https://www.gov.uk/capital-gains-tax/rates.

To calculate your CGT liability you will need to input your gains after deducting the capital gains allowance. A more complete treatment would also forward capital losses, but I suspect that is not a concern here.

Since you are talking about "an extra 10% now", I assume that this implies you are a basic rate taxpayer in terms of income (otherwise you'd be talking having to pay the 20% rate for higher and additional rate income taxpayers) and that the gains are not from property (which attracts Osbourne's "special" rates of 18% and 28%). I also assume that what you are really interested in is the amount of basic rate band "headroom" that you have left. CGT liability then splits the gain (after the capital gains allowance) into two bits: the "headroom" amount and the rest with the lower and higher rates of 10% and 20% respectively applied to these two bits.

This headroom is the difference between the basic rate band limit (cell B24) and the amount of income where tax is payable at basic rate. This latter is the sum of Income against "BR tax on earnings" (cell B60 or, equivalently cell G51), "BR tax on savings" (cell B66 or G53) and "BR tax on dividends" (cell B71 or G55). So a formula such as =B24-(B60+B66+B71) will allow you to calculate your headroom. Using such a formula, the downloaded spreadsheet gives a headroom value of £6,500 based on its current values and inputs (which are for 2016/17!).

Quite what the rules are if your income is below the personal allowance (so you have no income tax to pay) I'm not quite sure. I suspect that you cannot use any unused personal allowance against your capital gains. I also suspect that his is not a case you are concerned with.

The above gives you sufficient to make progress with your capital tax scenario planning.


modellingman

genou
Lemon Quarter
Posts: 1086
Joined: November 4th, 2016, 1:12 pm
Has thanked: 179 times
Been thanked: 375 times

Re: Excel Tax Calculator with Capital Gains?

#384096

Postby genou » February 6th, 2021, 11:07 am

Rajput1962 wrote:What i would like to work out now is how much of a holding >£12300 CGT allowance i could sell before crossing over into a higher tax threshold, even if it means paying extra CGT at 10% taking the annual CGT allowance into account.


You can download a 19/20 Excel tax calculator from https://sa2000.co.uk/saol.htm .

You'll need to bodge it by adding a BF CGT loss to get it to calculate for 20/21. Equally you'll need to adjust your income to get it to reflect the changes in Personal Allowance.

But it will let you model your options.

Rajput1962
Posts: 48
Joined: March 12th, 2018, 5:35 pm
Has thanked: 35 times
Been thanked: 3 times

Re: Excel Tax Calculator with Capital Gains?

#384136

Postby Rajput1962 » February 6th, 2021, 12:03 pm

Modellingman, thank you for your explanations and helpful suggestions.

In my original attempt i hadn't planned out how all the different income sources in the sequence PAYE>pension>interest>dividends>CGT all depended on how much of any prior allowance had been used up before calculating the next type. I also then made contributions to a SIPP in the last 3 years before i stopped working. This also changed the tax bands for the lower and higher rates before tax applied. Hence as i merrily progressed in setting up my spreadsheet for the next income source type, i found myself having to adjust the formulas to take account of any prior unused allowances and ended up with numerous very long nested =IF statements. It just got too complicated.

The highriskpaul version has 'small' formulas although it took me a while to figure out how they worked. You explain it very well!

What i have decided to do is to follow the same logic and add in a new set of rows/calculations below the dividend calcs, for CGT by copying the dividend formulas and then adjusting for CGT. The allowance/income rows at the top need some extra rows for CGT.
I imagined that CGT was just another 'dividend type' income. I need to do a bit more testing but I’m confident it works. I added some extra tax rows to the tax calculation and as i change the capital gain amounts they split into either 10%/20% or even 20%/40%, so i can see at a glance at what level it crosses into a different tax band.

Yes, am a basic rate taxpayer, and I could have just summed income, interest, dividends and subtracted from £50k for a quick headroom remaining answer but i thought a proper tax spreadsheet with all income/tax combinations would be a bit more of an interesting challenge to do in lockdown.

What I’ve also done is to set up a lookup tax table for previous years' allowances so I can see how things varied. I can also now anticipate what this year’s tax might be before the end of the tax year. This could be useful in deciding whether to use any ‘unused’ headroom because HMRC doesn’t release its online form until June/July, by which time it’s too late.

Finally, full credit once again to highriskpaul for a simpler but clever solution to calculating the numbers. I can now cross check what HMRC's online form calculates too.

Rajput1962
Posts: 48
Joined: March 12th, 2018, 5:35 pm
Has thanked: 35 times
Been thanked: 3 times

Re: Excel Tax Calculator with Capital Gains?

#384144

Postby Rajput1962 » February 6th, 2021, 12:23 pm

genou wrote:
You can download a 19/20 Excel tax calculator from https://sa2000.co.uk/saol.htm .


Now that is a spreadsheet with everything in it!

Thanks.

But i would have missed out drawing pretty boxes like i've done in the highriskpaul one for myself. It can take a veeerrry long time to do that! :lol:

Gengulphus
Lemon Quarter
Posts: 4255
Joined: November 4th, 2016, 1:17 am
Been thanked: 2628 times

Re: Excel Tax Calculator with Capital Gains?

#384168

Postby Gengulphus » February 6th, 2021, 1:30 pm

Another resource (the existence of which has taken some time to emerge from my memory!) is HMRC's Tax calculation summary notes. It basically lays out an exact order of doing the tax calculation in 'flowchart' form (other than for some fairly obscure cases, which are listed on its first page). It is something that can fairly straightforwardly be translated into spreadsheet form - though note that due to the large number of possible bits of calculation, doing that translation is decidedly tedious, especially as a considerable amount of care needs to be taken to observe the numerous "If any box on this page is a minus figure, substitute zero." and similar notes.

Possibly more usefully, it's quite a good guide to the various stages of the calculation and which order they should be done in.

Edit: One point I should note is that it doesn't do calculations of the individual capital gains and losses. That's part of the subject of HMRC's Capital gains summary notes, but unfortunately those notes only cover it rather cursorily and unsatisfactorily...

Gengulphus

Rajput1962
Posts: 48
Joined: March 12th, 2018, 5:35 pm
Has thanked: 35 times
Been thanked: 3 times

Re: Excel Tax Calculator with Capital Gains?

#384186

Postby Rajput1962 » February 6th, 2021, 2:20 pm

Gengulphus wrote:Edit: One point I should note is that it doesn't do calculations of the individual capital gains and losses. That's part of the subject of HMRC's Capital gains summary notes, but unfortunately those notes only cover it rather cursorily and unsatisfactorily...

Gengulphus


I have been using Microsoft's Money program (available as free download) to track my investment buys/sells and using this to calculate profit/losses on them. When selling fewer shares than the total holding, there is an option that pops up to decide whether to match shares sold to the earliest bought, latest bought, minimum gain and maximum gain. I have been using this to track total gains and can see at a glance whether i have exceeded the annual CGT limit or not. I've always kept below the limit but this year i have tried out a few what-ifs around selling X as opposed to Y and what difference that makes to the overall gain/loss. I did one day check how Money did it's calculations by exporting all buys/sales to excel and satisfied myself that its allocation logic is correct.

Maylix
2 Lemon pips
Posts: 146
Joined: November 4th, 2016, 12:16 pm
Has thanked: 391 times
Been thanked: 39 times

Re: Excel Tax Calculator with Capital Gains?

#384201

Postby Maylix » February 6th, 2021, 3:20 pm

Rajput1962 wrote:
I have been using Microsoft's Money program (available as free download) to track my investment buys/sells and using this to calculate profit/losses on them....


Hi Rajput,
About 3/4 years ago I finally managed to get all my investments into tax sheltered ISA's, so I haven't had to bother with the CGT calculations recently. I've also been using MS Money for several years, but I have never been able to use just it for CGT calcs. I've always had to use another program in conjunction with MS Money. I'm aware of its LIFO/FIFO/Max Gain/Min Gain options, but they don't take into account the UK matching rules. (same day disposal, within 30 day disposals, sect 104 holdings (is that even still a thing?) etc).
So I used MS Money for the lists of Buy/sell transactions and then imported the list into programme at CGTcalculator.com. Have a look at it, it's saved me many hours over the years. The Guy that developed it deserves a medal!
HTH
MayLix

Gengulphus
Lemon Quarter
Posts: 4255
Joined: November 4th, 2016, 1:17 am
Been thanked: 2628 times

Re: Excel Tax Calculator with Capital Gains?

#384269

Postby Gengulphus » February 6th, 2021, 6:39 pm

Rajput1962 wrote:
Gengulphus wrote:Edit: One point I should note is that it doesn't do calculations of the individual capital gains and losses. That's part of the subject of HMRC's Capital gains summary notes, but unfortunately those notes only cover it rather cursorily and unsatisfactorily...

I have been using Microsoft's Money program (available as free download) to track my investment buys/sells and using this to calculate profit/losses on them. When selling fewer shares than the total holding, there is an option that pops up to decide whether to match shares sold to the earliest bought, latest bought, minimum gain and maximum gain. I have been using this to track total gains and can see at a glance whether i have exceeded the annual CGT limit or not. I've always kept below the limit but this year i have tried out a few what-ifs around selling X as opposed to Y and what difference that makes to the overall gain/loss. I did one day check how Money did it's calculations by exporting all buys/sales to excel and satisfied myself that its allocation logic is correct.

Sounds wonderful - for someone dealing with the US taxman! Or at least, I think I've read somewhere that the US taxman allows people to match their sales to their purchases in a variety of ways, including (at least) those four.

However, the UK taxman specifies exactly how one must match sales to purchases - and the method he specifies isn't any of those four... So while Microsoft Money may be 'correct' in that those options do what they say on the tin, none of them can be guaranteed to be correct for filling in a UK tax return. And while any of them might happen to end up producing the right matching in quite a few cases, the only way to find out whether they do that in any particular case is to work out what matching the UK CGT rules require and then see which (if any) of the four options produces it...

Fairly briefly and ignoring corporate actions, the required matching for a UK tax return can be worked out by doing the following for each type of share involved:

1) List all your sales and purchases of the share concerned in date order. For each one, you require its date, the number of shares it is for, the sum of its allowable costs (including the number of shares times the share price at which purchased for purchases), and its proceeds (number of shares times share price for which they were sold, without deducting any costs) in the case of sales. I stress "all" because if you have more than one broker account with the same type of share in them (or a broker account and a certificated holding), you must do the calculation for all of them together, not separately (this implies that if a broker gives you a statement about how your sales and purchases match up for CGT, its usefulness to you is likely to be limited unless you hold no other broker accounts and no certificated holdings.

2) If you have any cases of two or more purchases on the same day, merge them into a single 'purchase' of their combined number of shares for their combined allowable costs.

3) If you have any cases of two or more sales on the same day, merge them into a single 'sale' of their combined number of shares for their combined allowable costs and their combined proceeds.

4) At this point, you have at most two transactions in the share on any single day, and if there are two, one is a sale and the other a purchase. If you have any cases of a sale and a purchase on the same day, 'match' them. (If they're for the same number of shares, calculate a gain or loss from them and remove both from the list. If they're for different numbers of shares, apportion the transaction for the larger number of shares into a 'matching' portion that has the same number of shares as the other transaction and a 'remainder' portion that has the rest of the shares, then calculate a gain or loss from the 'matching' portion and the other transaction, replace the transaction for the larger number of shares in the list with its 'remainder' transaction, and remove the other transaction from the list.)

5) At this point, you have at most one transaction in the share on any single day. Starting with a 'pool' of 0 shares bought for £0 allowable costs, work through the transactions in the list from the earliest to the latest. When you encounter a purchase, merge it into the 'pool'. When you encounter a sale, look ahead in the list to see whether there is a purchase in the following 30 days, then:

* if there are one or more such purchases, pick the earliest of them and 'match' the sale to it as described in 4) above. That will remove the sale and/or that purchase from the list, after which you continue working through the list in date order, starting with what is now the earliest-dated transaction in the list (which might be the 'remainder' of the sale we've just processed, or might be a later-dated transaction from the original list).

* If there are no such purchases, 'match' the sale to the 'pool', pretty much as described in 4) above. Normally, the number of shares in the 'pool' is at least the number sold, so this removes the sale from the list, and possibly reduces the 'pool' to no shares in the process. (That might not be the case if genuine shorting of shares has been done, as opposed to trading in CFDs or other derivatives that effectively short the shares - but anyone who genuinely shorts shares needs someone more knowledgable than me to tell them how to do CGT calculations for their transactions!)

A couple of points to note about that process:

* In principle, it starts step 5 right back at the beginning of your holding history, no matter how long ago that is. However, as long as you're certain you have all the transactions in the next 30 days after a sale in the list at the start of step 5), it is guaranteed that the way that sale is matched to purchases won't be changed by subsequent transactions. So even if your last sale in a tax year happens on April 5th, its very last day, the way it matches purchases becomes completely fixed on the 31st following day, i.e. on May 6th. So it is possible to finalise the CGT computations for a tax year, provided you wait until May 6th or later to do so! (And if your last sale in a tax year is earlier than April 5th, CGT computations finalisation day moves correspondingly earlier than May 6th - though never earlier than April 6th, of course.) This also means that provided you have reached CGT computations finalisation day, you can take step 5 only up to the last transaction in the tax year and record the state of the 'pool' and the list of remaining transactions, as the starting point for the following tax year's CGT computations.

* My description above of how to match sales to purchases for CGT is only valid if the earliest sale is no earlier than April 6th, 2008, because before then, a rather different set of sale-to-purchase matching rules was in effect - and there's a date before that (which IIRC was April 6th, 1998) before which a third set of such rules was in effect. (And I'm not entirely certain that was the first change of those rules after CGT was originally introduced!)

P.S. I see on trying to preview this post that Maylix has said much the same thing, only much more briefly and with less detail of the exact procedure but mentioning CGTcalculator.com. That's generally better if you know what the sequence of transactions is and just want to calculate the gains and losses - but if you want to plan a sequence of transactions to achieve a desired set of gains and losses, understanding the detailed sequence of the calculations can be helpful. So I regard this post and Maylix's post and complementing each other.

Gengulphus

Lootman
The full Lemon
Posts: 18968
Joined: November 4th, 2016, 3:58 pm
Has thanked: 639 times
Been thanked: 6704 times

Re: Excel Tax Calculator with Capital Gains?

#384272

Postby Lootman » February 6th, 2021, 6:56 pm

Gengulphus wrote:
Rajput1962 wrote:I have been using Microsoft's Money program (available as free download) to track my investment buys/sells and using this to calculate profit/losses on them. When selling fewer shares than the total holding, there is an option that pops up to decide whether to match shares sold to the earliest bought, latest bought, minimum gain and maximum gain.

Sounds wonderful - for someone dealing with the US taxman! Or at least, I think I've read somewhere that the US taxman allows people to match their sales to their purchases in a variety of ways, including (at least) those four.

However, the UK taxman specifies exactly how one must match sales to purchases - and the method he specifies isn't any of those four...

Yes, unlike the UK, the US rules allow one to use a variety of methods, which I make to be six. Although bear in mind that you are supposed to be consistent and brokers assume a default of FIFO from what I have seen. The options are:

1) FIFO (first in, first out)
2) LIFO (last in, first out)
3) HIFO (sell the lot with the highest cost basis first)
4) LOFO (sell the lot with the lowest cost basis first)
5) Average cost, which is the closest to the UK rules
6) Specific lot selection, which might be the most useful choice.

Two other differences. Positions held under a year are taxed at a higher CGT rate then positions held for more than a year. And a variation of our 30 day rule exists, but only for realised losses. The so-called "wash sale" rule doesn't apply where a sale generates a gain followed immediately by a repurchase.

Rajput1962
Posts: 48
Joined: March 12th, 2018, 5:35 pm
Has thanked: 35 times
Been thanked: 3 times

Re: Excel Tax Calculator with Capital Gains?

#384455

Postby Rajput1962 » February 7th, 2021, 1:59 pm

Maylix wrote:
So I used MS Money for the lists of Buy/sell transactions and then imported the list into programme at CGTcalculator.com. Have a look at it, it's saved me many hours over the years. The Guy that developed it deserves a medal!
HTH
MayLix


Gengulphus wrote: So I regard this post and Maylix's post and complementing each other.

Gengulphus


Maylix and Gengulphus - thanks both. I'm a newbie to the world of CGT and have learnt a lot from this thread! That CGTcalculator looks like a marvellous tool.

pauluk
Posts: 2
Joined: April 9th, 2024, 11:11 am

Re: Excel Tax Calculator with Capital Gains?

#658635

Postby pauluk » April 9th, 2024, 11:16 am

HI i have just stumbled across this post and am looking for a spreadsheet that takes care of share pooling calculations and bitcoin. Does this do that ? . I have have a google request for the spreadsheet can you authorise this for me please

Urbandreamer
Lemon Quarter
Posts: 3196
Joined: December 7th, 2016, 9:09 pm
Has thanked: 358 times
Been thanked: 1054 times

Re: Excel Tax Calculator with Capital Gains?

#658636

Postby Urbandreamer » April 9th, 2024, 11:32 am

pauluk wrote:HI i have just stumbled across this post and am looking for a spreadsheet that takes care of share pooling calculations and bitcoin. Does this do that ? . I have have a google request for the spreadsheet can you authorise this for me please


Have you considered Bittytax to deal with the bitcoin?

This link is to the old website V0.3.1
https://pypi.org/project/BittyTax/0.3.1/
This instruction
pip install BittyTax
however will install V0.5.2 or V0.5.3dev
You can get the source code here.
https://github.com/BittyTax/BittyTax

I've been messing with it for a few months and am relatively happy with it.
The conversion tool struggles a bit with converting Coinbase statements into the correct format, but this can be done using an awk script or a pivot table and "if" formula in excel/Lebreoffice.

pauluk
Posts: 2
Joined: April 9th, 2024, 11:11 am

Re: Excel Tax Calculator with Capital Gains?

#658638

Postby pauluk » April 9th, 2024, 11:42 am

Thanks for replying. Crickey i not familiar with Python is there a way i can chick it does not contain a virus if i download it
Paul

Urbandreamer
Lemon Quarter
Posts: 3196
Joined: December 7th, 2016, 9:09 pm
Has thanked: 358 times
Been thanked: 1054 times

Re: Excel Tax Calculator with Capital Gains?

#658644

Postby Urbandreamer » April 9th, 2024, 12:09 pm

pauluk wrote:Thanks for replying. Crickey i not familiar with Python is there a way i can chick it does not contain a virus if i download it
Paul


Sorry, but I can't think of an easy way to check that it doesn't contain any malicious code.
You could however reach out to other users.

I.E they have a presence upon X (twitter).
https://twitter.com/bitty_tax
Or upon Github.

One solution to your concern over malicious code would be to run it in a sandbox. I.E create a virtual machine with very little upon it to run the software in.

I've done a quick bit of research and here is an interview with the original author.
https://www.youtube.com/watch?v=Zt_dW6-XI_w


Return to “Taxes (Practical)”

Who is online

Users browsing this forum: No registered users and 20 guests