Reference table using cell value in INDEX/MATCH formula

Dr. Demento

Well-known Member
Joined
Nov 2, 2010
Messages
618
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I'm putting together a master list of phone numbers across the US. In order to keep things neat, each state is on a different sheet. Rather than change the formula 50x, I'm curious how I could adapt this formula so that it reads the cell that indicates the state.

Code:
=INDEX(tbl_xx[PHONE],MATCH([@STATE|COUNTY],tbl_xx[STATE|COUNTY],0))

where 'xx' can be read in the [STATE] column of the destination table.

Thanks y'all.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
See if this does what you need, I'm not entirely sure that INDIRECT will work with table references without setting something up to try it.

=INDEX(tbl_xx[PHONE],MATCH([@STATE|COUNTY],INDIRECT("tbl_"&[@STATE]&"[STATE|COUNTY]"),0))

If this doesn't work then I think that you might be out of luck.
 
Upvote 0
Jason,

Thanks so much. It wasn't precisely what I needed, but it was dang close!

Here's my final formula:

Code:
=INDEX(INDIRECT("tbl_"&[@STATE]&"[PHONE]"),MATCH([@STATE|COUNTY],INDIRECT("tbl_"&[@STATE]&"[STATE|COUNTY]"),0))

Thanks for furthering my XL education :)
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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