The Museum of HP Calculators

HP Forum Archive 18

 HP17BII+ - Help with writing Solve Equations...!Message #1 Posted by Will Lloyd (UK) on 3 Mar 2008, 8:44 a.m. I have recently bought a 17BII+, superb(having owned a 10B since about 1994). I am grappling with writing a solve equation to calculate net income (after tax) by entering the gross income (before tax). The problem is UK tax has tiers at different rates, for instance 0-£5225 is 0%, next tier is £5226-£7545 at 10% and the next £7546-£39825 at 22% with everything above £39826 at 40%. This has meant that it appears to be a lengthy formula using 'IF' and lots of parentheses. I have tried countless variations and the machine keeps saying "Invalid Equation". Any help/ thoughts please. Many thanks Will

 Re: HP17BII+ - Help with writing Solve Equations...!Message #2 Posted by Chris Dean on 3 Mar 2008, 9:16 a.m.,in response to message #1 by Will Lloyd (UK) My first thought is to check that your left and right parentheses match. Any chance of posting your code?

 Re: HP17BII+ - Help with writing Solve Equations...!Message #3 Posted by Don Shepherd on 3 Mar 2008, 9:35 a.m.,in response to message #1 by Will Lloyd (UK) Will, how about this: NET=G*IF(G<5225:0:IF(G<7545:.1:IF(G<39285:.22:.4)))

 Re: HP17BII+ - Help with writing Solve Equations...!Message #4 Posted by Bill (Smithville, NJ) on 3 Mar 2008, 9:54 a.m.,in response to message #3 by Don Shepherd Hi Will, One method is to calculate the net income at each of the full steps and then add on the amount of net income at the highest bracket. A solver equation to do this is: ```I=IF(G>39825: 32491.4+0.60*(G-39825): IF (G>7545: 7313+0.78*(G-7545): IF (G>5225: 5225+0.90*(G-5225): G))) ``` Bill

 Re: HP17BII+ - Help with writing Solve Equations...!Message #5 Posted by Don Shepherd on 3 Mar 2008, 10:46 a.m.,in response to message #3 by Don Shepherd Actually, I guess that would show tax, not net income. Try this instead: NET=G*IF(G<5225:1:IF(G<7545:.9:IF(G<39825:.78:.6)))

 Re: HP17BII+ - Help with writing Solve Equations...!Message #6 Posted by Marcus von Cube, Germany on 3 Mar 2008, 10:56 a.m.,in response to message #5 by Don Shepherd Don, I think you are not "slicing" the income correctly. Each tear has its own tax rate. So, if your income is high enough, all tax rates come into play. Since the values for all tears but the highest applicable are constant, these values can be precomputed, as Bill shows in his equation.

 Re: HP17BII+ - Help with writing Solve Equations...!Message #7 Posted by Chris Dean on 3 Mar 2008, 11:28 a.m.,in response to message #6 by Marcus von Cube, Germany I think this may be what is required as it slices up the salary. ```INC=G -0.10*IF(G>5225 AND G<7546:G-5225:IF(G>7525:7545-5225:0)) -0.22*IF(G>7545 AND G<39826:G-7545:IF(G>39825:39825-7545:0)) -0.40*IF(G>39825:G-39825:0) ``` I do hasten to add that I wrote this in Notepad and will try it later on my HP17BII+ when I finish work. A refinement would be to use L and G to fix the tax bands for when they change on a periodic basis. Chris Edited out some extra minuses and formatted! Update. I have keyed it in and it does work as expected. Edited: 3 Mar 2008, 12:37 p.m.

 Re: HP17BII+ - Help with writing Solve Equations...!Message #8 Posted by Don Shepherd on 3 Mar 2008, 11:36 a.m.,in response to message #6 by Marcus von Cube, Germany I see what you mean. Yes, you are right. The US does it differently.

Go back to the main exhibit hall