# Referencing a variable column header

**URL:** <https://connect.superhuman.com/t/referencing-a-variable-column-header/7031>\
**Category:** Ask the Community\
**Created:** [March 20, 2019, 2:27pm UTC](https://connect.superhuman.com/t/referencing-a-variable-column-header/7031 "2019-03-20T14:27:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Munier](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_munier/32/6249_2.png) [@Eric\_Munier](https://connect.superhuman.com/u/Eric_Munier)\
**Post date:** [March 20, 2019, 2:27pm UTC](https://connect.superhuman.com/t/referencing-a-variable-column-header/7031/1 "2019-03-20T14:27:09Z")

</div>

I am trying to reference a column from another table, where this column depends on the value of the row in the current table  
Basically something like that.  
**table1.[thisRow.Value].sum()**

At the moment I have succeeded with numerous switchif cases but this is becoming unmanageable as the table expands:  
**SwitchIf(thisRow.Value=“value1”,sum(table1.[value1]),thisRow.Value=“value2”,sum(table1.[value2]),thisRow.Value=“value3”,sum(table1.[value3]))**

It also means I need to edit the formula each time a new row is added to the table.

Is there any neat way to do all that in one go?

---

<div class="post-metadata">

**Author:** ![Ben\_Lee](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/ben_lee/32/49867_2.png) [@Ben\_Lee](https://connect.superhuman.com/u/Ben_Lee)\
**Post date:** [March 20, 2019, 3:03pm UTC](https://connect.superhuman.com/t/referencing-a-variable-column-header/7031/2 "2019-03-20T15:03:50Z")

</div>

It’s hard to say without seeing the table, but my guess is that it would help if you could transpose the lookup table so you could filter by row instead of by column.

If you want to share a sample document, we can look into it further and try to come up with some solutions. Check out this article on sharing documents and look for the “ **Share and Play** ” option…

[https://help.coda.io/working-with-others-in-coda/sharing-your-docs/sharing-your-doc](https://help.coda.io/working-with-others-in-coda/sharing-your-docs/sharing-your-doc)

_ **…and welcome to the Coda Community!** _ 🙂

---

<div class="post-metadata">

**Author:** ![Eric\_Munier](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_munier/32/6249_2.png) [@Eric\_Munier](https://connect.superhuman.com/u/Eric_Munier)\
**Post date:** [March 20, 2019, 3:22pm UTC](https://connect.superhuman.com/t/referencing-a-variable-column-header/7031/3 "2019-03-20T15:22:53Z")

</div>

Of course, here is a sample doc. This should clarify things

https://coda.io/embed/acToquld1h/_suByr?viewMode=embedplay

the formula for sum of shapes is the one I want to simplify 🙂

---

<div class="post-metadata">

**Author:** ![mallika](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mallika/32/12981_2.png) [@mallika](https://connect.superhuman.com/u/mallika)\
**Post date:** [March 20, 2019, 9:55pm UTC](https://connect.superhuman.com/t/referencing-a-variable-column-header/7031/4 "2019-03-20T21:55:31Z")

</div>

Hi @Eric_Munier - welcome!

What @Ben_Lee said - transposing the data will make it much more manageable and help you get the most out of Coda.

Take a look at [https://coda.io/d/Copy-of-Untitled\_d7OiZlXjQk1/Section-1\_suByr#\_luy5M](https://coda.io/d/Copy-of-Untitled_d7OiZlXjQk1/Section-1_suByr#_luy5M) where I have shown how the transpose would work.

And also [Filter created by to a summary table](https://connect.superhuman.com/t/filter-created-by-to-a-summary-table/6752/2) to look at ways to get a summary table going.

---

<div class="post-metadata">

**Author:** ![Eric\_Munier](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_munier/32/6249_2.png) [@Eric\_Munier](https://connect.superhuman.com/u/Eric_Munier)\
**Post date:** [March 21, 2019, 11:03am UTC](https://connect.superhuman.com/t/referencing-a-variable-column-header/7031/5 "2019-03-21T11:03:08Z")

</div>

Thanks so much for looking into that guys.  
@mallika. In you example how would I generate table 3 easily from table 2?

In my simplified example it can be done manually but in my real doc, my table 2 expands constantly both in rows and columns.  
That table 2 is already dependant on other tables so I can’t use a transposed version of that table a base. And lets also mention not all columns are numbers.  
I need to keep that table 2 as is, for parts of the doc to work.

Does that make sense?  
Any additional help would be appreciated 🙂
