capitals gains calculations for excel the same as ATO calculator does them.......does CG discount automatically when losses gone.
Formula for cell C4 shown at top of screen shot.
In my haste to remove personal and other info to do the 'screen shot' I reset the formula for C4 and what is shown above is wrong..............just change the number 20 to 14 and it is correct.
That is: cell C4 should read,
=IF(-1*(F8+M14)>=(L14+K14),(F8+M14)+(L14+K14),IF(L14>=-1*(F8+M14),K14/2+L14+F8+M14,(K14+(L14+M14+F8))/2))
What else......... the order you put the share trades into the sheet does not matter (the nested IF's work it out automatically in the calculation).
Cells K14, L14, M14 are just column sums.
Sample for K12,
=IF((G12*C12)-((C12*E12)+I12+F12)>=0,IF((H12-D12)/365>=1,(G12*C12)-((C12*E12)+I12+F12),"NA"),"NA")
Sample for L12,
=IF((G12*C12)-((C12*E12)+I12+F12)>=0,IF((H12-D12)/365<1,(G12*C12)-((C12*E12)+I12+F12),"NA"),"NA")
Sample for M12,
=IF(((G12*C12))-((C12*E12)+I12+F12)>0,"NA",((G12*C12))-((C12*E12)+I12+F12))
The above code is all you need to make it work. This is the simplest way I could code the calculation to be fully 'automatic' once the share trades are entered in the left hand columns. Use at your own risk of course but I have multi tested against ATO online system. Btw, I have never been a fan of having 'others' own my financial data...and certainly not a fan of paying them to own my data.