Using placeholders in formulas

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 :sweat_smile:
I know I could write the same expression a million times with every values, but I was looking for a quicker way :smiling_face:

Welcome to the Airtable community!

You had trouble uploading the picture because you do not yet have enough activity on the forums. Hang out for a while and in a few posts you will be able to upload pictures.

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} & "".

1 Like

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.