0

I am attempting to alter a spreadsheet that currently uses INDIRECT to dynamically determine a column range in a table. It's really slow.

I have a vba function that will determine the column name, but I now need to reference the column identified by that name. The end goal is to use it in a SUMIF statement.

Currently uses: =SUMIFS(My_Table_Name[UNIT_TOTAL],INDIRECT(MyNamedItem),1)

The value of MyNamedItem is My_Table_Name[THE_COLUMN]

I can return My_Table_Name[THE_COLUMN] as a string by a function, but then can't pass that into the SUMIF as an argument. How do I return it as a table column range which can be passed as an argument?

The formula could then be: =SUMIFS(My_table_name[UNIT_TOTAL],My_function_Name(),1)

2
  • Both INDIRECT and OFFSET volatile functions can almost always be replaced by the non-volatile INDEX. Can you provide a minimal reproducible example that no one has to retype from an image? Commented Apr 3, 2018 at 1:28
  • Please use formatting tools to properly edit and format your question/answer. Codes within sentences are to be formatted as code Very Important words to be bold , lesser important onces Italic Also use lists if necessary Commented Apr 3, 2018 at 1:30

1 Answer 1

1

Consider this screenshot:

enter image description here

The formula in cell K2 is

=SUMIFS(Table1[Unit Total],INDEX(Table1,,MATCH(I2,Table1[#Headers],0)),J2)

copied down. The table column is calculated dynamically with an Index/Match combo.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, that's great. I will just replace with INDEX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.