Forum Discussion

Mark_J_W's avatar
Mark_J_W
Copper Contributor
Aug 25, 2021
Solved

Referencing

I am trying to automate referencing from one sheet where I input data to a second sheet that pulls said data and does some calculations on it. The problem I am facing is that the input data has large...
  • mathetes's avatar
    mathetes
    Aug 26, 2021

    Mark_J_W 

     

    In essence, a well designed table, combined with XLOOKUP or one of the others, is functionally very much the same as a nested IF. You are looking up a reference (akin to the first element in an IF), finding it on a table, and then using the different columns in that table, employing different consequences.

     

    I'm attaching a spreadsheet I created just for fun--to do income tax estimating. It does use a very new function, called LET-so if you don't have the most recent Excel it may not work for you--but nested in that is an example of how VLOOKUP could work with the Federal Income Tax Tables. In fact, here's that portion of the formula just in case the more extended doesn't work:

    =VLOOKUP(A6,TTbl,4,1)+(VLOOKUP(A6,TTbl,6,1)*(A6-(VLOOKUP(A6,TTbl,8,1))))

    Where A6 is the income

    TTBl is the tax table (one of the following, depending on filling status)

     

    Note; the tables are laid out for legibility. The really functioning portions are column A (the low end of each tax bracket level) and then column D (offset of 4); Column F (offset of 6); column H (offset of 😎

     

    With that by way of background, what the formula does (it's on a separate sheet in the workbook) is lookup the first row in the table where the income in A6 is exceeded, falls back one row, and then, working across, says

    • take the number in the fourth column,
    • then the percentage in the sixth column and multiply that by the excess of income (A6) over the number in the 8th column
    • add them all up

    So for a filing status of Married filing Jointly and an income of $50,000, the relevant table is the one in the middle, rows 14 through 20.

    • The $50,000 income goes to row 16 (which exceeds it) and falls back to row 15
    • goes over to the fourth column to get 1,990
    • multiplies the excess of 50,000 over 19,900 (30100) times 12% to get 3,612
    • adds that to 1,990 to get 5,602 

    And that's the Federal Income tax owed on a Married Filing Jointly income of 50K.

     

    I don't know what all the tax table data is that you need for your business situation, but if they vary as well they might by location (State)...that could be part of your table. I hope my example, though, illustrates how VLOOKUP and a clean table could help.

Resources