Indirect used in xlookup

itsrich

Board Regular
Joined
Apr 13, 2009
Messages
73
Office Version
  1. 365
Platform
  1. Windows
Whenever I sit down to use INDIRECT, it messes with my brain! Once I get it correct, it is wonderful! It is the combination of "'"&A2&'"' that messes me up.

This is my current formula =XLOOKUP(A2,'[2025 Whole Schedule Bulk Items.xlsm]Cass'!$D:$D,'[2025 Whole Schedule Bulk Items.xlsm]Cass'!$F:$F,"Obsolete?")

I know I can replace the red and green text with INDIRCT. (it will be used to replace the same text in the Return_array part of the formula)

The file name in red will be in Cell B2

The tab name in green will be in Cell C2

This formula will be dragged down the Column (I will change the cell references to fit my needs, the syntax of the INDIRECT part of the formula kicks my backside)

Your brains will save me time. TYIA
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
How about
Excel Formula:
=XLOOKUP(A2,INDIRECT("'"&B2&C2&"'!$D:$D"),INDIRECT("'"&B2&C2&"'!$F:$F"),"Obsolete?")
 
Upvote 1
Solution
Fluff, YOU ARE AMAZING!!
dreid1011 yours took me a little more thinking!

Adding this to my Thug Notes spreadsheet! This is great stuff! TY so much!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 1
Fluff, YOU ARE AMAZING!!
dreid1011 yours took me a little more thinking!

Adding this to my Thug Notes spreadsheet! This is great stuff! TY so much!
Curious as I provided the exact same thing as Fluff did for the first INDIRECT, I just didn't expand it to the rest of the formula. My apologies. And you're welcome.
 
Upvote 1
You can see by my numbers, that I have been a member of Mr Excel for a few years. I can't thank you all enough. You have made my work much easier! TY!

dreid1011, you provided EXACTLY what I asked for. TYVM!

I should follow up and explain what I had to do to make these formulas work.

I started with this =XLOOKUP(A2,'[2025 Whole Schedule Bulk Items.xlsm]Cass'!$D:$D,'[2025 Whole Schedule Bulk Items.xlsm]Cass'!$F:$F,"Obsolete?")

I am using this =XLOOKUP(A2,INDIRECT("'"&B2&C2&"'!$D:$D"),INDIRECT("'"&B2&C2&"'!$F:$F"),"Obsolete?")

B2 = [2025 Whole Schedule Bulk Items.xlsm]
C2 = Cass

I hope this fills in the blanks for others who may come looking.

I will figure out how to move the [ and .xlsm] from B2 into the INDIRCT later. I got to here INDIRECT("'["&L1&".xlsm]'"&C1&"'!$D:$D"), but get a #REF. Again TYVM!
 
Upvote 0
You need to remove the ' after the ]
 
Upvote 1
You need to remove the ' after the ]
TY Fluff!

XLOOKUP(B3,INDIRECT("'["&$L$1&".xlsm]"&L3&"'!$D:$D"),INDIRECT("'["&$L$1&".xlsm]"&L3&"'!$F:$F"),"Obsolete?")

$L$1 = File name
L3 = Tab name

It is those pesky "'" combinations.
  • I see the single quote is where it would be normally in the formula.
  • The dbl quotes go around text
  • The & goes around the cell reference.
Is there a better way to describe the use of these characters with in INDIRECT?
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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