top of page

23. "Fraction Thereof" Taxes - Rounding Up Incrementally

Description

Rounds up incrementally (e.g. a tax is $3.00 for every $1,000 or fraction thereof).

Code

NOTE: All of the following examples compute total tax owed, where the tax rate is $3.00 for every $1,000 or fraction thereof. The value evaluated is the number variable CashValue. Where the figure 1000 is used, it refers to the size of the incremental increase (in this case, "every $1,000"). Where the figure 3 is used, it refers to the tax rate (in this case, "$3.00").

Code
CashValue / 1000
TRUNCATE( RESULT, 0 )
RESULT * 3
IF REMAINDER ( CashValue , 1000 ) > 0
RESULT + 3
END


Explanation
Basically, this calculation divides the number by 1000, trims off any decimals, and looks for a remainder. If there is no remainder, then the tax is simply 3 * RESULT ($3.00 for every $1,000). If there is a remainder, it adds an additional $3 to satisfy the "or fraction thereof" requirement.

Code
IF REMAINDER( CashValue , 1000 ) > 0
( TRUNCATE( ( CashValue / 1000 ) , 0 ) + 1 ) * 3
ELSE
( SalesPrice / 1000 ) * 3
END IF


Explanation
If CashValue divided by 1000 has a remainder, it means the CashValue falls into the "fraction thereof" requirement, so we will round up to the next tax increment by adding 1. Multiplying this number (the number of 1000s in the CashValue) by 3 (the tax rate) will give the amount of tax owed. If CashValue divided by 1000 does not have a remainder, the CashValue is an even 1000s amount, so we only need to know how many 1000s there are in the price and multiply this by 3 to get the amount of tax owed.


Code
3 * TRUNCATE( ( CashValue + 999.99 ) / 1000 , 0 )


Explanation
If the CashValue is an even $1,000 (or multiple of it), then adding 999.99 to it will not boost it into the next thousands range. For example, 1000 + 999.99 = 1999.99. When we divide this by 1000, we get 1.99999. And when we truncate the decimals from this number, we have 1. And 1 * 3 = 3, or $3.00 of taxes owed, which is correct ($3.00 for every $1,000). But if the CashValue is even one penny over $1,000, then adding 999.99 to it will boost it into the next thousands range. For example, 1000.01 + 999.99 = 2000. Dividing this by 1000, we get 2. And 2 * 3 = 6, or $6.00 of taxes owed, which is correct (... or fraction thereof). Another example, for a CashValue of $1999.99: 1999.99 + 999.99 = 2999.98. And 2999.98 divided by 1000 = 2.9998. Truncate the decimals, and the result is 2. And 2 * 3 = 6, or $6.00 in taxes, which is correct.

Code
( TRUNCATE( ( CashValue - 0.01) / 1000, 0 ) + 1 ) * 3


Explanation
This formula removes one cent from the CashValue, which drops it into the next lower thousands bracket if and only if the original CashValue was an even thousand (or multiple). We then divide by 1000, truncate the decimals, and automatically add an additional thousands value. If our original CashValue was an even thousand (or multiple), adding the additional thousands value will take us back to our original thousand multiple. If our original CashValue was not an even thousand, adding the additional thousands value will cover the "or fraction thereof" requirement. We can then multiply the thousands value by 3 to get the tax owed.

Explanation

bottom of page