INDIRECT(...) Help with cell reference

alombia

Board Regular
Joined
Jan 14, 2016
Messages
89
Hi,

I have the following array formula:

{=IFERROR(INDEX(MasterTable!$D$2:$GC$165,MATCH(1,IF($AA4=MasterTable!$C$2:$C$165,IF($AB4=MasterTable!$A$2:$A$165,1)),0),MATCH($X$3,MasterTable!$D$1:$GC$1,0)),"nothing found")}

I would like to refer to a value in say A1 instead of the above highlighted section. The value in A1 is GC165. I have tried the following:

{=IFERROR(INDEX(MasterTable!$D$2:INDIRECT(A1),MATCH(1,IF($AA4=MasterTable!$C$2:$C$165,IF($AB4=MasterTable!$A$2:$A$165,1)),0),MATCH($X$3,MasterTable!$D$1:$GC$1,0)),"nothing found")}

However, that does not work. Any ideas?

Thanks
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
What are you trying to make a variable - (a) column or (b) row?

If (a), it's already done by the second MATCH bit.
 
Upvote 0
That does not work either! Removing the INDIRECT and replacing with actual cell reference works. I.e. The following works: {=IFERROR(INDEX(MasterTable!$D$2:$GC$165,MATCH(1,IF($AA4=MasterTable!$C$2:$C$165,IF($AB4=MasterTable!$A$2:$A$165,1)),0),MATCH($X$3,MasterTable!$D$1:$GC$1,0)),"nothing found")} but not INDIRECT.
 
Upvote 0
Im doing a 3 way match (AA4, AB4 and X3) to retrieve data from sheet called MasterTable. I am aware of the second Match. However, I am not clear on why your question is relevant to my INDIRECT dilemma. The issue is GC165 is likely to change and so I am trying to dynamically insert this rather than hard code it if that makes sense.
BTW, the 3 way match was provided by an amazing person on this forum :)
 
Upvote 0
Why do you think that INDIRECT is relevant at all for a problem you fail to explicate? Once more, what is likely changing - row, column, or both?
 
Upvote 0
Column for now, though possible row as well.

You don't need for column because: the red part in

{=IFERROR(INDEX(MasterTable!$D$2:$GC$165,MATCH(1,IF($AA4=MasterTable!$C$2:$C$165,IF($AB4=MasterTable!$A$2:$A$165,1)),0),MATCH($X$3,MasterTable!$D$1:$GC$1,0)),"nothing found")}

takes care of that.
 
Upvote 0
You don't need for column because: the red part in

{=IFERROR(INDEX(MasterTable!$D$2:$GC$165,MATCH(1,IF($AA4=MasterTable!$C$2:$C$165,IF($AB4=MasterTable!$A$2:$A$165,1)),0),MATCH($X$3,MasterTable!$D$1:$GC$1,0)),"nothing found")}

takes care of that.

I am still not clear on your question. I apologise. The above formula works. How do i get it to work using INDIRECT instead for both GC165 and GC1? GC is likely to change.
 
Upvote 0

Forum statistics

Threads
1,214,848
Messages
6,121,917
Members
449,055
Latest member
KB13

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