Help

Extract numbers from field into a new field

Topic Labels: Base design Formulas
559 5
cancel
Showing results for 
Search instead for 
Did you mean: 
Wendy_Yelsik
6 - Interface Innovator
6 - Interface Innovator

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?   

5 Replies 5

Try this:

 

MID({field name}, FIND("(", {field name})+1, LEN({field name})-FIND("(", {field name})-1)

 

Sho
11 - Venus
11 - Venus

Here is the formula using Regex.

IF(
  {Name&Number},
  REGEX_EXTRACT(
    {Name&Number},
    "\\((\\d*)\\)$"
  )
)

 

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", "")
)

Thanks, Scott.  I used an alternative method not the regex function.   

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.