# Is it possible to convert a string into a formula?

**URL:** <https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766>\
**Category:** Ask the Community\
**Created:** [May 10, 2018, 11:11am UTC](https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766 "2018-05-10T11:11:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zsolt\_Bako](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/zsolt_bako/32/5829_2.png) [@Zsolt\_Bako](https://connect.superhuman.com/u/Zsolt_Bako)\
**Post date:** [May 10, 2018, 11:11am UTC](https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766/1 "2018-05-10T11:11:34Z")

</div>

I’m looking for something like INDIRECT in sheets/excel.

In the same column I’d like to reference different arguments in different rows (like multiple named formulas that I used somewhere else in the doc).

So the question is can I type [table 1].[column 2] in a text type cell (without using the “ **=** ” sign in the beginning) and use it as a reference in a more complex formula in another column?

Thanks!

---

<div class="post-metadata">

**Author:** ![Philipp\_Alexander\_Asbrand-Eickhoff](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/philipp_alexander_asbrand-eickhoff/32/5590_2.png) [@Philipp\_Alexander\_Asbrand-Eickhoff](https://connect.superhuman.com/u/Philipp_Alexander_Asbrand-Eickhoff)\
**Post date:** [May 10, 2018, 2:28pm UTC](https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766/2 "2018-05-10T14:28:09Z")

</div>

could you share your example?

---

<div class="post-metadata">

**Author:** ![Zsolt\_Bako](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/zsolt_bako/32/5829_2.png) [@Zsolt\_Bako](https://connect.superhuman.com/u/Zsolt_Bako)\
**Post date:** [May 10, 2018, 5:20pm UTC](https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766/3 "2018-05-10T17:20:23Z")

</div>

My actual use case is that I’d like to create a smart contract assembly tool. The goal is to generate contracts by combining a long set of available section/term templates and link/merge the different variables to our data sets.

Here is my experience so far:

**1st attempt:**  
Simple text + inline references:

 ![1st%20attempt](https://global.discourse-cdn.com/coda1/original/1X/59775c859d6a6f18ba5936bb224503d77d3926e3.png)  
This is cool but this way I can only use one set of sections/terms because as far as I know there is no option to hide/display a specific paragraph. Or is there such an option I just missed it?

**2nd attempt:**  
To make it more flexible and database-like I started to use the =Format() function. Here I have a merge template and a list of variables:

 ![2nd%20attempt](https://global.discourse-cdn.com/coda1/original/1X/de6b3afe4df106ef4fb2d394d2e984271447d995.png)

This way I could create a table supposed to contain all the necessary inputs to generate all the available sections/terms:

 ![3rd%20attempt](https://global.discourse-cdn.com/coda1/original/1X/9e6044f9b7bfe863ddaa7c187955c1d5d26ac787.png)  
This way based on the “Term type” column information I could generate filter the appropriate terms for the selected contract.

BUT the problem is that in Var1, Var2, Var3 etc… columns I’d need different references for each row. If I use the “=” sign when describing a reference for Var1 it gives the same reference for all rows.

**3rd attempt / idea:**  
It’s still not the best option but if I could use the “Var” columns to define the references with simple text and somehow use the content of these cells as part of a complex formula (such as Format) that would be a great workaround for now:

 ![4th%20attempt](https://global.discourse-cdn.com/coda1/original/1X/0020ce18493391579d3b5d7148c54d8c539d075f.png)

I know this is might not be the ideal use case of coda tables at this point. But if you have any solution for this or a totally different idea to achieve the goal (contract assembly tool based on a long list of template terms/sections using variables) I’d be very thankful because I 'm out of alternative ideas at this point 🙂

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![cnr](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/cnr/32/24174_2.png) [@cnr](https://connect.superhuman.com/u/cnr)\
**Post date:** [May 10, 2018, 5:41pm UTC](https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766/4 "2018-05-10T17:41:20Z")

</div>

Just wanted to note that this is a brilliant use case of Coda and I think would be an awesome feature to have available. I often find that even in simpler situations I would like the idea to set an environmental variable and use it repeatedly.

For example:

I have a lot of customers in a Customer Table.

For big customers, I want to display them in their own section.

I want to show a lot of information:  
A View of the Customer Table with only the applicable customer.  
Some bits of information that’s dependent on that table.  
A Selector that allows the user to select attributes of the customer to show.

I can set an environmental variable with

 ![image](https://global.discourse-cdn.com/coda1/original/1X/3caa1cbaf1cd78d25d2fcff07dc42d2fe57c1024.png)

Then I can copy and paste the contents to a new Section and all I have to do it change the customer\_name for that sheet and it all updates!

All if it, that is, except for the Selector table because that relies on a reference to the name of the View of Customer Table, whatever I may have changed that to locally. This, of course, makes it break.

If there was a way to interpret a string as Coda syntax, then this would be much easier.

I could do something like:

`table_to_reference = "[Table Name]"`  
`table_to_reference.toCoda().Filter(...).[Column Name]`

---

<div class="post-metadata">

**Author:** ![Johg\_Ananda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/johg_ananda/32/13930_2.png) [@Johg\_Ananda](https://connect.superhuman.com/u/Johg_Ananda)\
**Post date:** [June 2, 2019, 7:56pm UTC](https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766/5 "2019-06-02T19:56:40Z")

</div>

@Zsolt_Bako is it possible to share a working version to see what you’re trying to do?

I have done something similar. What about creating a table with all of the possible sections of the contract. Then create new tables for each new contract instance which matches the structure of the prior one; you can have a column like [Active?][Order][FieldValue]. Order can find its own rank amongst the active rows using a formula like this Rank(thisRow.[Row ID]=thisRow.[Active RowIDs]).

Then use the canvas with hardcoded formulas to generate the document by referencing this second table, pulling in =NewContract.filter(Order=1).[FieldValue] then have a bunch of hardcoded formulas with Order=Number of possible fields in the document. The inactive ones will render blank and you should just have the pertinent info!

---

<div class="post-metadata">

**Author:** ![Paul\_Danyliuk](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/paul_danyliuk/32/27228_2.png) [@Paul\_Danyliuk](https://connect.superhuman.com/u/Paul_Danyliuk)\
**Post date:** [June 3, 2019, 1:29pm UTC](https://connect.superhuman.com/t/is-it-possible-to-convert-a-string-into-a-formula/766/6 "2019-06-03T13:29:14Z")

</div>

@Zsolt_Bako I’d love to help you solve this — seems like a decent challenge.

There’s no `indirect` or any way to evaluate strings as formulas — at least not that I’m aware of.

Here’s the options that come to my mind:

### Option 1

1. Use your “1st attempt” approach with simple text + inline references. Make each paragraph a named formula
2. Add named checkboxes before each paragraph
3. On a separate section, write a formula that will concatenate all paragraphs, but omit the text if the switch is disabled:

https://coda.io/embed/vGhKZ0qZtt?viewMode=embedplay

Pro: easy  
Con: need to update the concatenation formula every time you change the number of sections.

### Option 2

Follow the 2nd attempt with a table and `VarX` columns, and make a button that will populate those var columns with the data from other tables. You can do this with `RunActions(ModifyRows(...), ModifyRows(...)...` chain of actions to edit every row individually, putting different data into `Var` cells.

Pro: you have it neatly organized in a table, so filtering and concatenating enabled clauses is super easy.  
Con: writing that button formula is a PITA. Also you’ll have to remember to press the button every time data is changed. Or you can write Automation rules to trigger that button every time a change in original data is detected.

P.S. Only now I’ve seen that this question is 1y old. Oh well, hope this still helps somebody 😅
