INDIRECT formula with Relative Column References

pliskers

Active Member
Joined
Sep 26, 2002
Messages
462
Office Version
  1. 2016
Platform
  1. Windows
I have a formula using the INDIRECT function to reference the name of the tab indicated in cell A11. This formula works and pulls in the indexed value in column G on that page. What I'd like to do is copy this formula across several columns and have the referenced index column change to H:H, I:I, etc.

Nothing I've tried has worked - is there any answer?

=INDEX(INDIRECT("'"&$A11&"'!g:g"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0))

Many thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this

=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),COLUMNAS($A$1:A1))
 
Upvote 0
Try this

=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),COLUMNAS($A$1:A1))

What does the COLUMNAS perform? By having the reference columns "G:J" within the INDIRECT formula in quotes, those column references will not change as I copy the formula across multiple columns.
 
Upvote 0
What does the COLUMNAS perform? By having the reference columns "G:J" within the INDIRECT formula in quotes, those column references will not change as I copy the formula across multiple columns.


The G:J reference does not change. But the result does change. Because in the INDEX function you can indicate the return value, 1 for first column, 2 for the second column, 3 for the third column and so on.
You must change J for the last column you will use.

---------------------------------

COLUMNAS($A$1:A1)
With this instruction you get the number 1, when you copy the formula across gets the number 2, 3, 4, and so on.

Then

=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),COLUMNAS($A$1:A1))
=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),1)
=INDEX(gets result from G,MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),1)

Next:
=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),COLUMNAS($A$1:B1))
=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),2)
=INDEX(gets result from H,MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),2)

Next:
=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),COLUMNAS($A$1:C1))
=INDEX(INDIRECT("'"&$A11&"'!G:J"),MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),3)
=INDEX(gets result from I,MATCH($C$8,INDIRECT("'"&$A11&"'!C:C"),0),3)

 
Upvote 0
What does the COLUMNAS perform? By having the reference columns "G:J" within the INDIRECT formula in quotes, those column references will not change as I copy the formula across multiple columns.

Very good, thank you!
 
Upvote 0
If I have understood correctly then you could also swap to VLOOKUP, only requiring one INDIRECT function.

=VLOOKUP($C$8,INDIRECT("'"&$A11&"'!C:J"),4+COLUMNS($B11:B11),0)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,701
Messages
6,173,920
Members
452,539
Latest member
deeme

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