A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
If the total already includes sales tax, select the applicable rate with IF and calculate the tax portion as Total × Rate ÷ (1 + Rate).
Assume:
-
A2= total sale including tax -
B2= rate selector (1or2) -
F4=0.1055(10.55%) -
F5=0.095(9.5%)
Enter this formula in the sales-tax cell:
=IF(B2=1,A2*$F$4/(1+$F$4),IF(B2=2,A2*$F$5/(1+$F$5),""))
Excel’s IF function returns one calculation when a condition is true and another when it is false.^1^ The division by 1 + rate is necessary because the tax is already included in the total; this follows the same method as extracting 5% tax with Gross/105*5.^2^
For example, if A2 is $110.55 and B2 is 1, the formula returns $10.55 of included tax.
To calculate the sale before tax:
=A2-IF(B2=1,A2*$F$4/(1+$F$4),IF(B2=2,A2*$F$5/(1+$F$5),""))
If A2 is instead the pre-tax amount, use multiplication rather than extraction:
=IF(B2=1,A2*$F$4,IF(B2=2,A2*$F$5,""))
Format the result cell as Currency. Keep the dollar signs in $F$4 and $F$5 so those references remain fixed when the formula is filled down.
References