# Reference Column Name with String

**URL:** <https://connect.superhuman.com/t/reference-column-name-with-string/6053>\
**Category:** Product Feedback\
**Created:** [January 31, 2019, 2:05pm UTC](https://connect.superhuman.com/t/reference-column-name-with-string/6053 "2019-01-31T14:05:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_RnW](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/michael_rnw/32/5747_2.png) [@Michael\_RnW](https://connect.superhuman.com/u/Michael_RnW)\
**Post date:** [January 31, 2019, 2:05pm UTC](https://connect.superhuman.com/t/reference-column-name-with-string/6053/1 "2019-01-31T14:05:09Z")

</div>

It would be great to be able to reference columns with procedural strings.  
When you have a large number of columns but with predictable names, this would be very useful.  
I’ll try to explain the use case for clarity.

Let’s say we have these columns.

- Column 1
- Column 2
- Column 3

I’d like to be able to do:  
`thisRow.(Concatenate("Column"," 3"))`

That would give me `thisRow.[Column 3]` but I currently can’t make it work.

I suppose I could change the topic title to “Reference Object Name with String”, columns are one of the use cases.

A possible solution would be to make brackets usable like this  
`thisRow.[(Concatenate("Column"," 3"))]`

But I get the feeling that if it was that simple, the Coda team would have done it already. Things are much more complicated behind the scenes, I can barely imagine. 😅

Another solution would be to have a specific function like `ToObject` or `ToColumnName`  
`thisRow.ToColumnName(Concatenate("Column"," 3"))`

Thank you for taking the time!

---

<div class="post-metadata">

**Author:** ![Lloyd\_Montgomery](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/lloyd_montgomery/32/5854_2.png) [@Lloyd\_Montgomery](https://connect.superhuman.com/u/Lloyd_Montgomery)\
**Post date:** [March 22, 2019, 12:08pm UTC](https://connect.superhuman.com/t/reference-column-name-with-string/6053/2 "2019-03-22T12:08:43Z")

</div>

I really like the idea of `ToColumnName` to be explicit about wanting to turn a string into a column name reference. I actually don’t think this is too complicated, but rather if implemented incorrectly could cause a lot of confusion for novices. That is why I like the idea of `ToColumnName`, because it is explicit, and would only be used by people who really know what they want.

Lloyd

---

<div class="post-metadata">

**Author:** ![Dalmo\_Mendonca](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/dalmo_mendonca/32/5813_2.png) [@Dalmo\_Mendonca](https://connect.superhuman.com/u/Dalmo_Mendonca)\
**Post date:** [July 2, 2019, 10:46pm UTC](https://connect.superhuman.com/t/reference-column-name-with-string/6053/3 "2019-07-02T22:46:40Z")

</div>

Found this solution using `Switch`:

> [@Referencing Column Name from another table](https://connect.superhuman.com/t/referencing-column-name-from-another-table/3621/6):
>
> I have figured it out! I used the switch statement to check the type of battery used and then summed the corresponding column in the Toys table. =Switch( thisRow.[Battery Type], "AAA", Toys.AAA.Sum(), "AA", Toys.AA.Sum(), "C", Toys.C.Sum(), "D", Toys.D.Sum(), "9V", Toys.9V.Sum() ) Thank you everyone again for your assistance in figuring this problem out. You guys are terrific! -Rick

---

<div class="post-metadata">

**Author:** ![Michael\_RnW](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/michael_rnw/32/5747_2.png) [@Michael\_RnW](https://connect.superhuman.com/u/Michael_RnW)\
**Post date:** [July 3, 2019, 9:35am UTC](https://connect.superhuman.com/t/reference-column-name-with-string/6053/4 "2019-07-03T09:35:13Z")

</div>

Thanks @Dalmo_Mendonca!  
I didn’t mean to imply that there are no solutions. 🙂 Switch would be the way to go right now indeed. But this will get very cumbersome very quickly if you have many columns.

I’m still rooting for my ToColumnName solution! 😃
