Need Someone with Better Eyes - Index Indirect

luke1438

Board Regular
Joined
Nov 1, 2004
Messages
156
I am trying to pull data from another workbook with a certain sheet name. The certain sheet name is in cell J1 within Workbook 1. The data I need in Workbook 1 cell J4 is in Workbook 2 cell O35. I am using the following formula:

INDEX(INDIRECT("'[Workbook 2.xlsx]"&J1&"'!"&$A$3:$O$40),MATCH($G4,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$3:$O$3"),0),MATCH($L$2,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$4:$A$40"),0))

The two MATCH/INDIRECT parts of the formula works fine, but it is the first part; INDEX(INDIRECT that is not. I clearly have something wrong because the range $A$3:$O$40 is highlighting in Workbook 1 when I click on the formula. I really need it to index Workbook 2.

If anyone sees my mistake please let me know what I have wrong where, please!

Thanks
Tim
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
The $A$3:$O$40 range should be in quotes.
 
Upvote 0
INDEX(INDIRECT("'[Workbook 2.xlsx]"&J1&"'!"&$A$3:$O$40),MATCH($G4,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$3:$O$3"),0),MATCH($L$2,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$4:$A$40"),0))

The two MATCH/INDIRECT
They may 'work', but from what I can see they are the wrong way around. In an INDEX function, the 2nd argument is the row number and the 3rd argument is the column number. Therefore the red and blue sections need to be swapped.

The orange part is what @Fluff was referring to but it also is the wrong range. It should be $A$4:$O$40

So, try this
Excel Formula:
=INDEX(INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$4:$O$40"),MATCH($L$2,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$4:$A$40"),0),MATCH($G4,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$3:$O$3"),0))
 
Upvote 0
Thank you so much. Very good catch to both of you. Sometimes writing the formula I think of the information I want first and don't think about how the formula should be written.
Thanks again
Tim
 
Upvote 0
Solution
INDEX(INDIRECT("'[Workbook 2.xlsx]"&J1&"'!"&"$A$3:$O$40"),MATCH($L$2,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$3:$A$40"),0),MATCH($G4,INDIRECT("'[Workbook 2.xlsx]"&J1&"'!$A$3:$O$3"),0))
 
Upvote 0
Solution

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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