Oct 19, 2023 05:34 AM
My field has a name followed by a number - SAM ADAMS (1234). I need to put the 1234 in it's own field. What is the best way to write a formula to do that?
Oct 19, 2023 08:30 AM
Try this:
MID({field name}, FIND("(", {field name})+1, LEN({field name})-FIND("(", {field name})-1)
Oct 19, 2023 05:06 PM
Here is the formula using Regex.
IF(
{Name&Number},
REGEX_EXTRACT(
{Name&Number},
"\\((\\d*)\\)$"
)
)
Oct 19, 2023 05:22 PM
Actually, I just looked this up — this is the formula you would use to extract numbers from a string of text:
IF(
{text},
REGEX_REPLACE({text}, "\\D", "")
)
Oct 26, 2023 11:20 AM
Thanks, Scott. I used an alternative method not the regex function.
Oct 26, 2023 01:09 PM
Another way of doing this could be to use Airtable's VALUE() function, but that is highly unpredictable since it also performs math! So use that one with caution.