Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

# Using placeholders in formulas

Topic Labels: Formulas
244 1
cancel
Showing results for
Did you mean:
4 - Data Explorer

Hello, I don’t know if it’s a stupid question or not, but I was wondering if this exists.

In a CONCATENATE formula I was collecting names of ingredients and quantities, but I didn’t like how “0.25 lt” was looking like, so I thought of changing “0,25” with “¼” using an IF function:
`CONCATENATE(IF({Q.ty} = '0.25',"¼", IF({Q.ty} = '0.5',"½",IF({Q.ty} = '0.75',"¾",{Q.ty}))),' ',Ingredient)`

And it works, but obviously it works only with 0.25 and not with 1.25, 2.25 or more. (I don’t know why but every attempt to upload the example picture fails.)
I was wondering if I could use a letter or something, like you can do in Math with the letter “n”, to write the expression like this:
`CONCATENATE(IF({Q.ty} = 'n.25',"n ¼", IF({Q.ty} = 'n.5',"n ½",IF({Q.ty} = 'n.75',"n ¾",{Q.ty}))),' ',Ingredient)`

Probably I could do something like changing every “.25” with a “¼”, but it could works with every number except 0, because it will result in “0¼” which is more ugly :grinning_face_with_sweat:
I know I could write the same expression a million times with every values, but I was looking for a quicker way :smiling_face:

If you want to use placeholders in a formula, you can use the REGEX functions. RegEx can be a bit tricky to figure out, so I recommend playing with a regular expression tester (follow the links in the support article). You will also need to convert your number to a string, which can be done by concatenate it with an empty string: `{Q.ty} & ""`.