How to look up a value in a table from a different sheet?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,532
Office Version
  1. 365
Platform
  1. Windows
I need to look up a value in a table from a different sheet. This minisheet shows what I have tried that don't work. These formulas (F6:F8) are in the same sheet just so they would be in the minisheet.

20210322 Electric usage log 04-2018 to 02-2021.xlsx
CDEF
5CityPopulation
6Tokyo37,435,191#N/A
7Delhi 29,399,141#VALUE!
8Shanghai 26,317,104#VALUE!
9Mexico City 21,671,908
10New York City8,622,357
11Los Angeles4,085,014
12San Jose1,036,242
Populations
Cell Formulas
RangeFormula
F6F6=XLOOKUP("Delhi",Populations[City],Populations[Population])
F7F7=XLOOKUP("delhi",Populations[City],Populations[@Population])
F8F8=XLOOKUP("delhi",Populations[City],2)

These formulas all get errors. The first gets a #N/A, the other two a #VALUE.

What am I doing wrong?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
And when I click on the MiniSheet button, xl2bb draws 15-20 lines, something like this:

1652141708320.png

I think the actual number is quite a few more, but you get the idea. They disappear in less than a second, so I can't get a screen shot.
 
Upvote 0
If you are getting a #N/A error the "Delhi" does not exist in the table.
 
Upvote 0
Some of the cities have trailing spaces in the table. You could remove those by using the TRIM function in another area of your workbook and then paste the values back into your table or alter the formula shown in F6 as below.

Excel Formula:
=XLOOKUP("Delhi",TRIM(Populations[City]),Populations[Population])

Hope that helps.

Regards,
Ken
 
Upvote 0
Solution
Some of the cities have trailing spaces in the table. You could remove those by using the TRIM function in another area of your workbook and then paste the values back into your table or alter the formula shown in F6 as below.

Excel Formula:
=XLOOKUP("Delhi",TRIM(Populations[City]),Populations[Population])

Hope that helps.

Regards,
Ken
Good catch. That was the problem. Thanks. ?
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

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