79645126

Date: 2025-05-30 08:29:06
Score: 0.5
Natty:
Report link

I know this is an old thread but I have a technique that works fairly well for this:

  1. Wrap your data range with curly braces { } so query will use the Col1, Col2 syntax rather than A, B column names.

  2. Use match to query your header row and find the column number you want to query.

  3. Dynamically insert that row into your query string. It makes for a more complex query, but it's relatively maintainable as the primary value you modify over time is a plain text column name.

I'm using index to return the header row of a table:

index(Customer_Matrix[#ALL],1,0)

And then using match to search the header row for the column I need:

match("Horizontal Use Cases",index(Customer_Matrix[#ALL],1,0),0)

And that allows me to construct a query which can dynamically refer to table rows by name. Deleting or re-ordering table rows no longer breaks your query.

query({Customer_Matrix},"select Col1 where Col" & match("Horizontal Use Cases",index(Customer_Matrix[#ALL],1,0),0) & " contains '" & A30 & "'")
Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ross Cooper-Smith