Skip to main content

pull out first names from a multi-select User field

  • June 26, 2023
  • 5 replies
  • 87 views

Forum|alt.badge.img+3
  • Participating Frequently

I have a User field that allows multiple users to be tagged. I'd like to write a formula that will pull those people's first names into a comma-delimited list. I came up with the following:

LEFT({Users}, FIND(" ", {Users})-1)

...which does the trick if there's just one person tagged. But if multiple people are tagged, the formula only returns the first name of the first person.

Is there a way to make this work? I have a feeling this might require a REGEX formula though I'm not so clear on how they work...

Thank you!

5 replies

Forum|alt.badge.img+24
  • Inspiring
  • June 27, 2023

Hello, @kts 
Yes, it is true that REGEX is difficult to understand
Can you show a few examples of inputs and ideal outputs?


Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • June 29, 2023

Hello, @kts 
Yes, it is true that REGEX is difficult to understand
Can you show a few examples of inputs and ideal outputs?


Sure thing @Sho! If the list of contributors is:

Jane Doe, Joe Smith, Johnny Appleseed

The output should ideally be:

Jane, Joe, Johnny

@Sho wrote:

Hello, @kts 
Yes, it is true that REGEX is difficult to understand
Can you show a few examples of inputs and ideal outputs?





Forum|alt.badge.img+24
  • Inspiring
  • June 30, 2023

A simple way to do this is to create a "Short Name" formula field in the "Users" table and put your formula in it.
Then, from the linked table, you can lookup or rollup the "Short Name" field to get the list.


Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • June 30, 2023

A simple way to do this is to create a "Short Name" formula field in the "Users" table and put your formula in it.
Then, from the linked table, you can lookup or rollup the "Short Name" field to get the list.


That makes sense, but in this case, I'm using a Collaborator/User field that links directly to Airtable users, rather than using a linked record to a separate Team table.


Forum|alt.badge.img+24
  • Inspiring
  • July 1, 2023

Oh, yes, it was a user field
I know it's weird, but how about this!

 

REGEX_REPLACE( LEFT(REGEX_EXTRACT(Users,"([^ ]* ?){1}"),3)&", "& LEFT(REGEX_EXTRACT(Users,"([^ ]* ?){3}"),3)&", "& LEFT(REGEX_EXTRACT(Users,"([^ ]* ?){5}"),3)&", "& LEFT(REGEX_EXTRACT(Users,"([^ ]* ?){7}"),3)&", "& LEFT(REGEX_EXTRACT(Users,"([^ ]* ?){9}"),3)&", "& LEFT(REGEX_EXTRACT(Users,"([^ ]* ?){11}"),3) ,"(, ){2,}|, $","")

 

The number needs to be increased by 2 for each maximum number of users.