• Learn
  • Blog
  • Pricing
  • About
  • Sign in

Tip: Display quotes in a text field using a formula

Text fields with multiple lines work great for displaying text you "calculate" using a formula. Read this tip to learn how to include quotation marks in calculated text.

Text fields with multiple lines can be used to present text you “calculate” using a formula. What if you want to include quotation marks as part of the calculated text, though? Let’s say that you want your user to enter a name in the Name field and present the text string You entered “John” to the user if he or she enters “John.” This formula won’t work:

"You entered "" & Name & """

Calcapp Creator won’t complain if you use this formula, but your text field will contain the text You entered “ & Name & “ and not You entered “John”.

Why is that? The reason is that quotation marks are special in formulas, in that they separate text strings from the rest of the formula. In order to include a literal quotation mark, you need to include two quotation marks instead of just one. (Microsoft Excel uses the same system.) That explains why our first attempt produced the text string You entered “ & Name & “ and not You entered “John”.

In order to get the desired result, use this formula instead:

"You entered """ & Name & """"

Note that we need to include four quotation marks in a row if the quoted text should only include a single quotation mark.

Do you want to share a tip with other Calcapp users through this blog? Let us know!

« Tip: Display a time duration in your apps Letter: Resetting specific fields and improving reports »