|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Build a Dynamic Income Tax Calculator – Part 2 of 2
By David H. Ringstrom, CPA
Last month I explained how to use the VLOOKUP
function to cross-reference tax rates from a tax rate table. I then extended
the functionality by creating four different tables: Single, Married-Joint,
Married-Single, and Head of Household, as shown in Figure 1. After assigning a
range name to each table, I used Microsoft Office Excel’s Data Validation
feature to create an in-cell drop-down list comprised of these range names. Finally,
I modified my VLOOKUP functions to use Excel’s INDIRECT function. INDIRECT
replaced the static look-up range originally specified in the VLOOKUP formula. If I choose Married-Joint from the list, the VLOOKUP
function will calculate the tax due based on that table. I can choose
Married-Single from the list to determine the additional tax due under that
filing status. At this point I have an efficient calculator for determining the
amount due based on a taxable income input, but I’d rather not have four separate
tables. This month I’ll dig deeper, and show you how to create a single table
of tax rates, as shown in Figure 2. The final result will involve two rather
complex formulas, but we’ll build them a step at a time.
Understand
MATCH The MATCH function is akin to VLOOKUP – you specify
what to look for, where to look, and the type of match that you’d like. When
the MATCH function finds the criteria you specify, it returns the position
number within the list –otherwise it returns #N/A. The position number can then
be used within an INDEX function to return a specific value, much like VLOOKUP
or HLOOKUP. Although VLOOKUP is a useful look-up function, your look-up
criteria must always be the first column of your data table. Instead, the
INDEX/MATCH combination enables you to create a look-up based on any column
within the table. The MATCH function has three arguments:
Since MATCH only returns the position number within
the list, we’ll then use the INDEX function to return actual amounts from the
table. Comprehend
INDEX I only have space in this article to describe the
reference capability of the INDEX function, but Excel’s Help feature discusses
the array and multiple area capabilities of INDEX. The reference capability of
INDEX has three arguments:
Appreciate
OFFSET Not many Excel users know about the OFFSET function.
In essence, it’s a means for shifting a range of a certain number of columns and/or rows away
from a starting point. In the case of our tax calculator, we’ll use OFFSET to
have the MATCH function refer to the proper columns within our tax rate table.
The OFFSET function has five arguments: ·
Reference: The
starting point for our range, such as A2:A8.
Create
the Tax Calculator Now that we have the function basics out of the way,
let’s build a tax table that refers to a single table instead of four different
tables. Enter these values in cells A2
through A8 of a blank worksheet:
Enter these values in cells B2 through C8 of the
worksheet:
Enter these values in cells D2 through E8 of the
worksheet:
Enter these values in cells F2 through G8 of the
worksheet:
Enter these values in cells H2 through I8 of the
worksheet:
Add these headings to the spreadsheet:
Enter 125,000 in cell B11, and then use Data
Validation to create an in-cell drop-down list in cell E10:
Single,Married-Joint,Married-Single,Head
Of Household
Caution: Be sure that the
contents of the Source field exactly match the values that you entered in cells
B2, D2, F2, and H2.
We’ll now enter the formula to determine the tax
rate. Enter this formula in cell C11: =MATCH(B11,B3:B8,1) Based on an input of 125,000 in cell B11, the
formula should return the number 4. We’ve instructed MATCH to look at the
taxable income for the Single filing status, and asked it to find the closest
income bracket for $125,000. Next, we’ll add the INDEX function, so that we can
get the actual tax rate. Modify the formula in cell C11 to be as follows: =INDEX(A3:A8,MATCH(B11,B3:B8,1)) At this point the formula should return 28%. However,
we’re referencing a static range of B3:B8 for our income brackets, and instead
we want the formula to shift automatically based on our choice in cell E11. To
do so, we’ll employ the OFFSET function. As shown in Figure 5, modify the
formula in cell C11 to match this: =INDEX(A3:A8,MATCH(B11,OFFSET(A3:A8,0,MATCH(E11,A2:I2,0)-1),1))
Although this may look intimidating, we basically
replaced the B3:B8 portion of the formula with this component: OFFSET(A3:A8,0,MATCH(E11,A2:I2,0)-1) Our OFFSET function contains these arguments:
At this point the formula should return 28%. This
number should change to 25% if you choose Married-Joint in cell E11, 33% for
Married-Joint, or remain at 28% if you
choose Head of Household. We’re now ready to create the final formula in our
table, which will perform the actual tax calculation. Enter this formula in
cell D11: =INDEX(A2:I8,MATCH(C11,A3:A8,0),MATCH(E11,A2:I2,0)+1) In this case, we’re specifying the entire table
range for the reference argument of the INDEX function, and then using two
MATCH functions to return the row and column positions. This MATCH function
determines the row for our tax rate: MATCH(C11,A3:A8,0) Notice the zero in the match type position, because
we want to ensure an exact match on the tax rate. The second MATCH function
determines which column has the base-tax amount: MATCH(E11,A2:I2,0)+1 As before, we’re determining which column our filing
status appears in within row 2, but then adding 1 to that amount, since the
base tax amount is in the next column over. We now need to calculate the marginal tax amount
beyond the base tax. To do so, add this to the end of the formula in cell D11: (B11-INDEX(A2:I8,MATCH(C11,A2:A8,0),MATCH(E11,A2:I2,0))+1)*C11 The INDEX function returns the tax tier associated
with the tax rate, and this amount is subtracted from the taxable income. $1 is
added to this amount to determine the precise marginal amount to be taxed, and
then the amount in parenthesis is multiplied by the tax rate in cell C11. The
complete formula is shown in Figure 6.
The views and opinions expressed in this column are those of the author and do not necessarily reflect the opinions of Microsoft. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Printer-friendly version |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||