INDIRECT w/ INDEX/MATCH for Named Ranges/Tables

BeardedSith

New Member
Joined
Mar 9, 2020
Messages
6
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I had this working at one time but as all things go, I accidently deleted the formula and can't for the life of me remember what syntax I used to accomplish this task. Here's the code, the long version of this question will follow:

Code:
=IFERROR(INDEX(INDIRECT("'" & [@SheetName] & "'!" & "[Wolfs]"),MATCH([@First],(INDIRECT("'" & [@SheetName] & "'!" & "[Part]")),0)),"Not Found")

Long Version:
I have a sheet that I use for pricing updates on our eCommerce website. The owner sends me a spreadsheet that I input into a spreadsheet template, then I export all the necessary data from our eCommerce site. The sheet has the following columns on the "Updates" sheet (more than this, but this is the part that matters)"
COLUMNS:
Price
Retail
SheetName
First

ROWS:

1) 8.99, 9.99, meguiars, M-1808
2) 10.99, 12,99, meguiars, M-1990
3) 5.99, 12.99, meguiars, M-1991

On the second sheet I have:
COLUMNS:
Wolfs
Part
List


Without the INDIRECT in the formula, it works perfectly getting the exact data I need. The problem is having the named range as a lookup location. I can do INDIRECT("'" & [@SheetName] & "'!" & "A2") but the "[Wolfs]", etc. is causing #REF! errors. So I'm obviously missing some quotes or something somewhere. Thank in advance!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I noticed that it's possible to output the range to these forums, so here ya go.
Pricing Changes.xlsx
ABCDEFGHIJKLM
1Product IDProduct SKUProduct NameBrandCategory StringOLDPriceOLDRetailPriceRetailCHANGESheetNameFirstNOTES
22830100RMarinco Threaded Sealing RingMarincoElectrical/Adapters\; Plugs\; Outlets/Sealing7.9910.83$7.99$11.550marinco100R
3283912VBPMarinco ConnectPro PlugMarincoElectrical;Electrical/Adapters\; Plugs\; Outlets16.9924.73$19.99$28.25xmarinco12VBP
4284012VCPMarinco ConnectPro Receptacle and PlugMarincoElectrical;Electrical/Adapters\; Plugs\; Outlets37.9955.5$41.99$63.38xmarinco12VCP
52865304EL-BCRMarinco Contoured Power Inlet - ChromeMarincoElectrical/Adapters\; Plugs\; Outlets/Inlets79.99124.73Not FoundNot Found marinco304EL-BCR
Updates
Cell Formulas
RangeFormula
H2:H5H2=IFERROR(INDEX(marinco[Wolfs],MATCH([@First],marinco[Part],0)),"Not Found")
I2:I5I2=IFERROR(INDEX(marinco[ List],MATCH([@First],marinco[Part],0)),"Not Found")
J2:J5J2=IFERROR(INDEX(marinco[ch],MATCH([@First],marinco[Part],0)),"")
L2:L5L2=IFERROR(LEFT([@[Product SKU]], FIND(" ",[@[Product SKU]])-1),[@[Product SKU]])
 
Last edited by a moderator:
Upvote 0
I was able to get this working, but I'm not sure that I made the correct assumptions. For example, this works:

=IFERROR(INDEX( INDIRECT([@SheetName]&"[Wolfs]"), MATCH([@First],INDIRECT([@SheetName]&"[Part]"),0) ),"Not Found")

But the syntax used here assumes that I have a named table...whose name is found in the SheetName column (and that is confusing). That named table could be anywhere within the Excel workbook. For this trial, I created a separate worksheet named ProdList, and on that ProdList worksheet, I included column headings of Wolfs, Part, List, and Ch because those headings are all used in the formulas on your main sheet.
Book1
ABCDEFG
1PartWolfsListChRetailCol7
2304EL4.97ifsch 4 304el9.99extra
3100R8.97andsch 4 100r12.99words
412VCP11.97butsch 4 12vcp12.99here
5
ProdList


See the main table here for an example of how the formulas look to access information found in the Table named "marinco" (which just happens to be on a different sheet called ProdList) using the INDIRECT function to construct the reference.
Book1
ABCDEFGHIJKLM
1Product IDProduct SKUProduct NameBrandCategory StringOLDPriceOLDRetailPriceRetailCHANGESheetNameFirstNOTES
22830100RMarinco Threaded Sealing RingMarincoElectrical/Adapters\; Plugs\; Outlets/Sealing7.9910.838.97andsch 4 100rmarinco100R
3283912VBPMarinco ConnectPro PlugMarincoElectrical;Electrical/Adapters\; Plugs\; Outlets16.9924.73Not FoundNot Found marinco12VBP
4284012VCPMarinco ConnectPro Receptacle and PlugMarincoElectrical;Electrical/Adapters\; Plugs\; Outlets37.9955.511.97butsch 4 12vcpmarinco12VCP
52865304EL BCRMarinco Contoured Power Inlet - ChromeMarincoElectrical/Adapters\; Plugs\; Outlets/Inlets79.99124.734.97ifsch 4 304elmarinco304EL
FirstSheet
Cell Formulas
RangeFormula
H2:H5H2=IFERROR(INDEX( INDIRECT([@SheetName]&"[Wolfs]"), MATCH([@First],INDIRECT([@SheetName]&"[Part]"),0) ),"Not Found")
I2:I5I2=IFERROR(INDEX( INDIRECT([@SheetName]&" [ LIST]"),MATCH([@First], INDIRECT([@SheetName]&"[Part]"),0)),"Not Found") [/LIST]
J2:J5J2=IFERROR(INDEX(INDIRECT([@SheetName]&"[Ch]"),MATCH([@First],INDIRECT([@SheetName]&"[Part]"),0)),"")
L2:L5L2=IFERROR(LEFT([@[Product SKU]], FIND(" ",[@[Product SKU]])-1),[@[Product SKU]])
 
Last edited by a moderator:
Upvote 0
I should have mentioned that my first table shown is named "marinco".
This is where my assumption may be incorrect. Are you trying to access information in a table whose name is shown in the SheetName column, or are you trying to access information found on a sheet named "marinco"?
 
Upvote 0
Yeah, I should have done a better job explaining that, sorry! The @sheetname is also the name of the named range/table on that sheet. I add, delete, and edit the other sheets all the time, so I make the named ranges within the sheets the exact same name as the sheet themselves. Just to make it all easier when I'm plugging in data.
 
Upvote 0
Okay, thanks for that clarification. I think the formula syntax shown above should work then. Let me know if you run into any trouble getting everything working again.
 
Upvote 0
It worked perfectly, thanks! I kept trying to put an exclamation point or extra &'s in there.
 
Upvote 0
You're welcome...glad to help. You could use either approach...either the Worksheet/Range method (with the "!") or the Structured Reference method, but based on some clues in your formula, it looked as if you were originally running with the SR method. You might consider changing the name of the SheetName column to something that clarifies that the table name appearing in that column is what matters.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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