Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Re: Extract numbers from field into a new field

1608 0
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
Databaser
12 - Earth
12 - Earth

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*)\\)$"
  )
)

 

ScottWorld
18 - Pluto
18 - Pluto

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.   

ScottWorld
18 - Pluto
18 - Pluto

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.