Allow user input to change Table reference in Index, match, match

Stevenb2020

New Member
Joined
Feb 19, 2019
Messages
3
I have the following Index, match, match in my worksheet:

=-INDEX(Table2018PL[[#Headers],[#Data],[GlCode]:[4thQtr]],MATCH('FULL YEAR'!$A8,Table2018PL[[#Headers],[#Data],[GlCode]],0),MATCH('FULL YEAR'!E$5,Table2018PL[[#Headers],[GlCode]:[4thQtr]],0))

I would like to replace Table2018PL with Table2019PL using data from an input cell in another tab. The reference appears 3 times, once for array and twice for lookup array. Essentially what I want to do is make the "2018" variable based on user input.

Is there a way to do this?

Thanks,
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,619
Office Version
  1. 2007
Platform
  1. Windows
=-INDEX(INDIRECT("Table" & tab!B2 & "PL[[#Headers],[#Data],[GlCode]:[4thQtr]]"),MATCH('FULL YEAR'!$A8,INDIRECT("Table" tab!B2 & "PL[[#Headers],[#Data],[GlCode]]"),0),MATCH('FULL YEAR'!E$5,INDIRECT("Table" & tab!B2 & "PL[[#Headers],[GlCode]:[4thQtr]]"),0))


Change "tab" and "B2" by the name of your sheet and the cell where you will put the year
 

Stevenb2020

New Member
Joined
Feb 19, 2019
Messages
3
I have tried that and it still doesn't work. User input is into cell B10 on tab 'Set-up'. Here is what I am trying:

=-INDEX("Table"&'Set-up'!B10&"PL"[[#Headers],[#Data],[GlCode]:[4thQtr]],MATCH('FULL YEAR'!$A8,"Table"&'Set-up'!B10&"PL"[[#Headers],[#Data],[GlCode]],0),MATCH('FULL YEAR'!E$5,"Table"&'Set-up'!B10&"PL"[[#Headers],[GlCode]:[4thQtr]],0))

"PL"[[#Headers] is highlighted in grey and

The message I get is:

There's a problem with this formula.

Not trying to type a formula?
When the first character is an equal (=) of minus (-) sign, Excel thinks it's a formula:

you type: =1+1, cell shows: 2

To get around this type an apostrophe (') first:

you type: '=1+1, cell shows: =1+1

OK Help
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,619
Office Version
  1. 2007
Platform
  1. Windows
Check the correct position of the "

For example:

My formula

=-INDEX(INDIRECT("Table" & tab!B2 & "PL[[#Headers],[#Data],[GlCode]:[4thQtr]]")

Your formula

=-INDEX("Table"&'Set-up'!B10&"PL"[[#Headers],[#Data],[GlCode]:[4thQtr]]
Try this:

=-INDEX(INDIRECT("Table" & 'Set-up'!B10 & "PL[[#Headers],[#Data],[GlCode]:[4thQtr]]"),MATCH('FULL YEAR'!$A8,INDIRECT("Table" 'Set-up'!B10 & "PL[[#Headers],[#Data],[GlCode]]"),0),MATCH('FULL YEAR'!E$5,INDIRECT("Table" & 'Set-up'!B10 & "PL[[#Headers],[GlCode]:[4thQtr]]"),0))


 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,619
Office Version
  1. 2007
Platform
  1. Windows
I'm glad to help you. Thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,552
Messages
5,625,463
Members
416,107
Latest member
AVaes

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
Top