Dynamically Reference a Structured Table

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
3,142
Office Version
  1. 365
Platform
  1. Windows
I have two structured Excel Tables and a Cell called PRChoice that redirects my formulas to pull the right data. PR_A_Tbl and PR_B_Tbl. They have identical headers with different data sets. I want to simplify my formulas so I don't have to repeat the functions as:
=IFERROR(IFS(PRChoice="PR_A",XLOOKUP([@ID],PR_A_Tbl[ID],PR_A_Tbl[2023 LE],"",0),PRChoice="PR_B",XLOOKUP([@ID],PR_B_Tbl[ID],PR_B_Tbl[2023 LE],"",0),TRUE,"")*1000,0)

I created a Named range called PR_X_Tbl where I thought I could choose the right Table with the formula: =LET(PRTBL,IF(PRChoice="PR_B",PR_B_Tbl[#All],PR_A_Tbl[#All]),PRTBL)

That didn't work when I reference it like a structured table.

Is there another way to dynamically reference a Structured Table?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
How about
Excel Formula:
=XLOOKUP([@ID],switch(PRChoice,"PR_A",PR_A_Tbl[ID],"PR_B",PR_B_Tbl[ID]),switch(PRChoice,"PR_A",PR_A_Tbl[2023 LE],"PR_B",PR_B_Tbl[2023 LE]),"",0)
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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