Column name in formula

Hi,

I am trying to have a lookup where one of the conditions is the column name. How do I set that up?

I have one table where all my inventory movement is being recorded (Stock Tracker). I am trying to set up another table (Balances) which will calculate balances of each inventory item at each location. So I want to plug in the location (column header) in the lookup formula. It works when hardcoded, but ideally I want it to be a formula if possible.

https://mayanklhila.getgrist.com/oi2YyHdb7o1E/Untitled-document

Thank you for the help!

Cheers,
M

There isn’t a supported way to get the ID of the current column, but there is a hacky way that happens to work today:

table.table._engine._current_node.col_id

The downside is that it peeks into the internals of the data engine, so there is no guarantee it will continue working in future versions of the code.

That works, thank you!