Forum Discussion
pulling tax rate from another sheet
Hi, I'm trying to pull the tax rate from another sheet based on a match from a cell in the sheet I'm working from. So if the cell reference is found in the other sheet I want it to return the tax rate to the cell with the formula in it. I've tried XLOOKUP and Index/match and get nothing but the formula as a result. I don't even get an error.
=XLOOKUP(IF F2='Table 1'!A2:D589,Table 1'!,5)
F2 is the city I want the tax rate for
The range if in Table 1 which holds city, county, tax, etc
Column 5 is where the tax rate exists in Table 1
I'm retired and rusty, lol. Please help?
Here's a simpler formula that will work
=VLOOKUP(F2,'Table 1'!$C$2:$D$591,2,0)
As noted by Peter and Sergei, though, you have some cities missing from your table, so you'll get an #NA on occasion
You also need to convert the format of that cell (the whole column actually) to "number" or "general"--as you posted it, so presumably as you have it, it's formatted as "Text" and then will do exactly what it's been doing, show you your formula as text.
4 Replies
- mathetesSilver Contributor
Here's a simpler formula that will work
=VLOOKUP(F2,'Table 1'!$C$2:$D$591,2,0)
As noted by Peter and Sergei, though, you have some cities missing from your table, so you'll get an #NA on occasion
You also need to convert the format of that cell (the whole column actually) to "number" or "general"--as you posted it, so presumably as you have it, it's formatted as "Text" and then will do exactly what it's been doing, show you your formula as text.
- barb72Copper ContributorThank you so much!!! That worked. I received the Paypal file from someone else and didn't even think to check the formatting on that column. It seems some of the cities are not in the other file so either Paypal made an error or my friend did when she downloaded it and removed all data except for GA. I'll have her double check it. I don't know where she got the list sheet from either so who knows, lol.
Thanks so much!!!
- SergeiBaklanDiamond Contributor
- PeterBartholomew1Silver Contributor
Assuming the data is converted to Excel Tables
=XLOOKUP([@OrderShipCity], TaxRateTbl[CITY], TaxRateTbl[RATE],"Not found")
will at least give a result. Only the first occurrence of the city is looked up and some cities are missing.