Skip to main content
Solved

Extract text before first comma in lookup field

  • May 13, 2022
  • 4 replies
  • 238 views

Hello Airtable world,
We’re trying to extract customer’s names from a lookup field of a synced table where the names sometimes include a second name after the comma. Our data usually looks like this:

John Smith
Jane Doe, Terry Doe
James Bond

We’d like to be able to have a column that displays the following:

John Smith
Jane Doe
James Bond

So far we’ve tried the functions below, both returning and error.
IF({Customer's Name}, REGEX_EXTRACT({Customer's Name}, "[^,]*"))
LEFT({Customer's Name}, FIND(",", {Customer's Name}) -1)

The number of characters is unpredictable both, before and after the comma. I suspect the biggest issue is that our primary field from which we’re hoping to pull information is a lookup field and not just simple text. Is there a solution to achieving this?

Best answer by Kamille_Parks11

Lookups usually return as arrays, and the functions you’re using only work on strings. Solve this by replacing {Customer's Name} with {Customer's Name}&"", which converts the array into a string.

4 replies

Kamille_Parks11
Forum|alt.badge.img+27
  • Brainy
  • 2679 replies
  • Answer
  • May 13, 2022

Lookups usually return as arrays, and the functions you’re using only work on strings. Solve this by replacing {Customer's Name} with {Customer's Name}&"", which converts the array into a string.


  • Author
  • New Participant
  • 1 reply
  • May 13, 2022

Lookups usually return as arrays, and the functions you’re using only work on strings. Solve this by replacing {Customer's Name} with {Customer's Name}&"", which converts the array into a string.


Amazing, thank you so much!


Forum|alt.badge.img+4

Lookups usually return as arrays, and the functions you’re using only work on strings. Solve this by replacing {Customer's Name} with {Customer's Name}&"", which converts the array into a string.


 

hello, I have the same problem I would like the data of the "Participant field" to be extracted and separated on each formula field

thank you for your help

https://airtable.com/shroD4pRoA52pXcg6 


Forum|alt.badge.img+4
 

hello, I have the same problem I would like the data of the "Participant field" to be extracted and separated on each formula field

thank you for your help

https://airtable.com/shroD4pRoA52pXcg6 


I found the solution by adding "ARRAYJOIN" in the formula.
Modify location 1 ([^,]+,?){1}") to extract the rest of the string in the following fields.

 

The formula
REGEX_EXTRACT(ARRAYJOIN({Participant nom (from Imported table)}),"([^,]+,?){1}")

best regards