Skip to main content

We have a list of names and dates, like so

 

McClelland, David (1820 - 1899)

 

We would like to separate the dates from the the name, so everything in parentheses would be extracted and moved to a new column.

 

I know there must be some code for this, but I am not sure what it is.

 

Help!

 

Kevin

 

Hey ​@K_B1!

Rather than using a script for it, I would suggest to use (1) creating a new Formula field, (2) use the formula shown below.

Make sure to replace “Name” with the actual field name where McClelland, David (1820 - 1899) is found.

IF(
FIND("(", Name),
MID(
Name,
FIND("(", Name) + 1,
FIND(")", Name) - FIND("(", Name) - 1
)
)


You’d have the following

 



Output:
 



You can now convert your formula field to a Single Line Text field, or copy and paste the values on a different field if that is what you need!

Let me know if this helps :D 

Mike, Consultant @ Automatic Nation


 

There are several different formulas that can extract data. Here is a method that uses REGEX.

 

 

 

Here is a matching formula to get the name by itself.

 

 


Dear Mike_AutomaticN,

 

Thanks.  This formula mostly worked, but in about 20 intances (in 3K or so), it produce the following weird errors - see images.

 

any recommended modification to the formula?

 

 

Kevin


Dear Kouvonne -

The first REGEX formula did not seem to work. I copied it exactly and changed {name} accordingly, but it generated an error.

The second REGEX formula, to extract the name only, seems to have worked though I am still checking.

 

Any ideas?

 

Kevin

 


Dear Mike -

 

The error noted above seems to be associated with foreign characters that look like this: ē, ō, ū

 

While the issues is not universal, these are diacriticals associated with Portuguese, Vietnamese, and Japanese names.


Ok solved.  It had to do with character encoding.  Fixed.

 


Glad you found a solution that worked.

When building formulas, it is helpful to have sample data that encompasses the full range of expected values. 

How did you fix the character encoding?

I am curious about my formula not working. Can you share screen shots of the formula as you typed it, the sample data, and the error that you see?


I fixed it by manually re-entering some of the diacritical characters. Apparently they were originally copy / pasted into AirTable from Wikipedia and other sites. Somehow they were encoded differently than the rest of the text. I do not know why this broke the formula, only that once I addressed the characters the formula worked.


Thanks for explaining how manually retyping the characters worked. Manually retyping text helps surprisingly often.


Reply