Calculate initial value given different percentages and the total

80 Views Asked by At

Let's imagine an invoice:

Sub total: 100 (what we don't know)

Tax1 21%: 21 (this increases the total)

Tax2 10%: 10 (this de-increase the total)

TOTAL: 111

For a single tax we could do:

100 (total) * 100 / (21 + 100) = 82.64 (sub total)

But how can we calculate the sub total when having different percentages?

Note, every tax affects the original price only (without other taxes)

1

There are 1 best solutions below

0
On BEST ANSWER
subTotal = total * 100 / (totalTaxes - totalWithholdings + 100)

For example, for:

sub total: X

+tax1 21%

+tax2 10%

-tax1 15%

-tax2 7%

TOTAL: 150

subTotal = 150 * 100 / (31 - 22 + 100)

subtTotal = 137.61