Indirect reference to column in a table

KrsOne20

New Member
Joined
Dec 5, 2014
Messages
21
I have a table where all references to columns are stated as [@[COLUMNNAME]] (I use Excel +2010)

Depending on value in column X, I want to return column 1, 2 or 3 in my lookup. I want to avoid using multiple if statements for this purpose. Instead I want to create a dynamic INDIRECT reference to column.

e1fg3JS.png


For example if column priority is "quarter'', it should return Q4-2017 (the reference in Excel is =[@[Quarter key]]. My current indirect reference is
Code:
=INDIRECT("[@["&[@Priority]&" key]]")
, however it keeps returning error #REF

When I just enter my formula without the Indirect function (just entering ="[@["&[@Priority]&" key]]"), I do get =[@[Quarter key]].
So what am I doing wrong?

Also added extract of file as attachment
https://sheet.zoho.com/sheet/editor...f121d7b851ff7b920cc106ed40003a0c0ae6a6466008b
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
The problem seems to lie in the table name. This works:

=INDIRECT("Table1["&[Priority]&" key]")

This also works:

=INDIRECT($R$6&"["&[Priority]&" key]")

if you put "Table1" in R6.

But you can't remove Table1 from the formula, or use @ as a shortcut. Probably INDIRECT tries to resolve the reference without "knowing" where the formula is.

You could also do something like this:

=CHOOSE(MATCH([Priority],{"Quarter","Semi-Annual","Annual"},0),[Quarter key],[Semi-annual key],[Annual key])
 
Upvote 0
The problem seems to lie in the table name. This works:

=INDIRECT("Table1["&[Priority]&" key]")

This also works:

=INDIRECT($R$6&"["&[Priority]&" key]")

if you put "Table1" in R6.

But you can't remove Table1 from the formula, or use @ as a shortcut. Probably INDIRECT tries to resolve the reference without "knowing" where the formula is.

You could also do something like this:

=CHOOSE(MATCH([Priority],{"Quarter","Semi-Annual","Annual"},0),[Quarter key],[Semi-annual key],[Annual key])

Awesome, thanks! I tried the first and CHOOSE function, both worked flawless. Didnt know about the CHOOSE function, seems very usefull will use it now more often.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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