Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Airtable Community
- Discussions
- Ask A Question
- Formulas
- Is it possible to make comments within a formula?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Topic Labels:
Formulas

3
3341
14

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Feb 28, 2020 11:48 AM

Can you make a single line comments within a formula?

Reply

14 Replies 14

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Feb 28, 2020 12:47 PM

No, you cannot make comments in a formula field.

If you have a particularly complex formula that you might need to adjust later, you should probably document it elsewhere.

If the formula is a calculation based on inputted values that will never change, consider shifting the logic to the Scripting block. You can include comments in the JavaScript. One disadvantage is that you will still have to manually run the Scripting block.

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 04, 2020 07:26 AM

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 04, 2020 07:38 AM

Would love this! Please add to the Product Suggestions topic!

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Oct 24, 2020 12:42 AM

This would really be a useful addition to make complex formulas easier to understand.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jul 03, 2021 05:26 PM

Was just going to search for answer how to do this and this post came out on top search results. Right on. Yes exactly this is what we need.

I have many fields with massive formulas, about 1-2 letter size pages printed in regular font and I can’t break them down because I am running out of fields in Airtable (500 fields limit). So now I am getting headache of the super long formulas.

Being able to put comments like ** THIS IS A COMMENT ** or /// THIS IS A COMMENT \\ would be fantastic.

(I can’t put the formulas in scripts, first I have no idea about programming and secondly the formulas use 100’s of fields in the table so values constantly change)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jul 03, 2021 09:39 PM

While you still cannot make an official comment in a formula, I use this workaround to comment more complex formulas:

For example, if my formula is …

```
{lookup field} & ""
```

I can comment it like this …

```
IF(
"convert lookup value to a string",
{lookup field} & ""
)
```

I also use this technique to document “magic numbers” in formulas:

```
IF(
"circumference = 2 * radius * pi, where pi is 3.14",
2 * {radius} * 3.14
)
```

This workaround takes advantage of the fact that the string will always evaluate as true. When properly used, this technique also does not affect the resulting data type of the formula.

Keep in mind that this technique adds extra calculation time to the formula, which may already take a long time to calculate. If the formula is approaching the undocumented formula limits, you may also need to take care in adding branches to the formula just for the sake of comments.

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jul 05, 2021 10:35 AM

Interesting, this will definitively help to add comments to remind myself what is the purpose of things in the formula. Now I actually realize I could add some dummy formulas to that like…

IF ( “…this is some comment for the next section in the formula …”,0,0)

… if it is surrounded by + or - signs

or

IF ( “…this is some comment for the next section in the formula …”,1,1)

… if it is surrounded by * or / signs

Great. At least something.

Also - I need to get used to use spaces in Airtable. I am used to use formulas in Excel and there are no spaces allowed so old habits never die and always keep working without spaces out of fear something will break some day if I have spaces in Airtable. Are spaces completely safe?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jul 05, 2021 10:58 AM

White space (spaces, new lines, etc.) are safe *between* elements in a formula. For example, between a field name and an operator.

White space is not allowed between a function name and the opening parenthesis. For example, this is not valid:

`IF ( "This is not allowed", 1, 1)`

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jul 05, 2021 03:56 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jul 05, 2021 05:47 PM

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jul 07, 2021 12:08 PM

If I was still relying Airtable formula box for writing formulas, I would have already ended up in a rehab :winking_face:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Aug 19, 2021 03:18 PM

Adding comments in formulas with operators +,-,*,/ and with concatenated formulas like “…”&IF(aaa,bbb,ccc) is easy and works well. Turned out to be my favorite undocumented feature of Airtable :winking_face:

More tricky seems are formulas that have many AND and OR arguments that I need to comment. Example:

`IF(OR(AND(a=0,b=0,c=0,d=0),OR(e=0,f=0),OR(AND(g=0,h=0,j=0))),"east","west")`

I need to add a comment after the string … f=0)

This formula checks for valid (true) result. If you say that IF(X,Y) formula results always in TRUE result, if I put that inside my AND/OR formula, the whole formula may provide incorrect result, because the dummy formula result is always True.

I tried to make something like this here but I am not sure if this is correct logic. Shouldn’t this always result in field result: “east” ?

`IF(OR(AND(a=0,b=0,c=0,d=0),OR(e=0,f=0),IF("......this is my dummy formula with a comment.....",0),OR(AND(g=0,h=0,j=0))),"east","west")`

Since the dummy formula `IF("......this is my dummy formula with a comment.....",0)`

provides always TRUE response I could put it into another formula that would always generate a FALSE response. Something like this:

`IF(OR(AND(a=0,b=0,c=0,d=0),OR(e=0,f=0),AND(IF("......this is my dummy formula with a comment.....",""),0=1),OR(AND(g=0,h=0,j=0))),"east","west")`

Am I doing this right?

The “east” and “west” options are just examples. In reality my formula has instead of “east” another formula and it has BLANK() instead of “west”.

Much appreciated and thank you.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Aug 19, 2021 03:32 PM

OK, scratch that. I found a simple **solution**.

`IF(OR(AND(a=0,b=0,c=0,d=0),OR(e=0,f=0),"......this is my dummy formula with a comment....."="",OR(AND(g=0,h=0,j=0))),"east","west")`

I have removed the IF function around my comment and placed the comment into equation **“comment”=""**. The result of this will always be negative so it will not impact my main formula. Done :winking_face:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Aug 23, 2023 07:51 AM

Kuovonne saves the day again!