convert vlookup formula into xlookup for taxes

sleek12

Board Regular
Joined
May 3, 2014
Messages
62
Office Version
  1. 365
Platform
  1. Windows
I have the following vlookup formula for taxes, is there a way it can be converted to xlookup;-
'=VLOOKUP(B2,Rates,2,TRUE)+VLOOKUP(B2,Rates,3,TRUE)*(B2-VLOOKUP(B2,Rates,1,TRUE))-2400'
the formula is located in C2
tax-rates (1)PAYE.xlsx
ABCDEF
1Taxable IncomeAfter NSSF Tax on this income NHIFNSSFNett pay
269,930.0069,730.008,932.001,700.0020059,098.00
Workings
Cell Formulas
RangeFormula
B2B2=A2-200
C2C2=VLOOKUP(B2,Rates,2,TRUE)+VLOOKUP(B2,Rates,3,TRUE)*(B2-VLOOKUP(B2,Rates,1,TRUE))-2400
F2F2=A2-C2-D2-E2
Named Ranges
NameRefers ToCells
Rates=Mastersheet!$A$1:$C$5C2


The rates are here;-
tax-rates (1)PAYE.xlsx
ABC
1000.1
22400024000.15
34066749000.2
45733482330.25
5
Mastersheet


thanks for your help
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
is there a way it can be converted to xlookup
There is, but why would you want to make the formula more complicated if the existing one works?
Excel Formula:
=XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$B$1:$B$5)+XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$C$1:$C$5)*(B2-XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$A$1:$A$5))-2400
 
Upvote 0
Its not working, am getting
tax-rates (1)PAYE.xlsx
C
5#N/A
Workings
Cell Formulas
RangeFormula
C5C5=XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$B$1:$B$5)+XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$C$1:$C$5)*(B2-XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$A$1:$A$5))-2400


The main reason am moving away from vlookup(RIP) to newer functions like XLOOKUP,FILTER,UNIQUE,SWITCH,etc
 
Upvote 0
Its worked now after i added -1

tax-rates (1)PAYE.xlsx
ABCDEF
1Taxable IncomeAfter NSSF Tax on this income NHIFNSSFNett pay
280,000.0079,800.0011,449.501,700.0020066,650.50
30.25
411,449.50
511,449.50
Workings
Cell Formulas
RangeFormula
B2B2=A2-200
F2F2=A2-C2-D2-E2
C2C2=VLOOKUP(B2,Mastersheet!A1:C5,2,TRUE)+VLOOKUP(B2,Mastersheet!A1:C5,3,TRUE)*(B2-VLOOKUP(B2,Mastersheet!A1:C5,1,TRUE))-2400
C3C3=XLOOKUP(B2,Mastersheet!A1:A5,Mastersheet!C1:C5,,-1)
C4C4=IF(B2>=Mastersheet!A4,Sheet1!B4)+(B2-Mastersheet!A4)*0.25-2400
C5C5=XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$B$1:$B$5,,-1)+XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$C$1:$C$5,,-1)*(B2-XLOOKUP(B2,Mastersheet!$A$1:$A$5,Mastersheet!$A$1:$A$5,,-1))-2400
 
Upvote 0
Solution
The main reason am moving away from vlookup(RIP) to newer functions
That seems like a kind of pointless reason. It is extremely unlikely that the older functions would be removed from future versions of excel so making a formula more complicated than it needs to be for the sake of using a newer function is absolutely ridiculous.

Without knowing the tax rules for your country I can't say for certain, but I'm not entirely convinced that the results of your original formula are correct. (as an example, a figure below 24000 in B2 will give you a negative result which just doesn't seem right).

Most tax formulas use sumproduct(if arrays rather than multiple lookups.
 
Upvote 0
That seems like a kind of pointless reason. It is extremely unlikely that the older functions would be removed from future versions of excel so making a formula more complicated than it needs to be for the sake of using a newer function is absolutely ridiculous.

Without knowing the tax rules for your country I can't say for certain, but I'm not entirely convinced that the results of your original formula are correct. (as an example, a figure below 24000 in B2 will give you a negative result which just doesn't seem right).

Most tax formulas use sumproduct(if arrays rather than multiple lookups.
Yes, you're indeed right, person with income under 24000/- dont pay tax.

Kenyan tax rates
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,614
Members
449,039
Latest member
Mbone Mathonsi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top