Aug 28, 2022 10:14 AM
This may have been covered, but I cannot find it. I have a field that has several emails in it. It is a lookup field I need to extract the first email in the list. Can someone help me with the formula?
Solved! Go to Solution.
Aug 28, 2022 05:54 PM
Aug 28, 2022 10:57 AM
Hi @Kirsten_Kern,
Instead of a Lookup field, use a Rollup field and use the ArrayJoin function
Then in your formula field use the following. Replace {Email Rollup} with your reference.
REGEX_EXTRACT({Email Rollup}, "^(.+?),")
Aug 28, 2022 11:03 AM
Hi Zack,
Thank you for your prompt response.
Works great for all fields except where I only have one email and then I get an error message. Is there a way to fix this?
Aug 28, 2022 11:09 AM
Move the question mark to after the comma ^(.+),?
REGEX_EXTRACT({Email Rollup}, "^(.+),?")
Aug 28, 2022 11:19 AM
Thank you; however, that returned all of the multiples. To be clear, I used the second formula and the error message was removed but the extraction of only one email part of the formula gave me multiple emails again. Basically, the second formula with the question mark moved after the comma gave me my exactly what my rollup gave me.
Aug 28, 2022 11:52 AM
Sorry, I thought that was working for me.
The below does work for me in Airtable.
Try this [^,]*
Aug 28, 2022 12:13 PM
Brilliant. I am doing the happy dance. Thank you. Those REGEX thingies are like martian speak to me.
:kiss: .
For anyone looking over our shoulders, this was the final formula: REGEX_EXTRACT({One email}, “[^,]*”)
Where, {One email} was my reference field.
Aug 28, 2022 12:17 PM
They are very new to me as well but are great with some basic understanding :thumbs_up:
Thanks to @Ben.Young. Thought they were scary and never attempted learning them before.
Aug 28, 2022 01:50 PM
As a bit of a side note, you can actually just write the whole formula inside of the rollup field’s formula configuration.
I’m on mobile right now, so this might look weird or need a tweak, but it would look something like this:
IF(
values,
REGEX_EXTRACT(
values,
'[^,]*'
)
)
Aug 28, 2022 05:54 PM
Thank you! That just eliminated a few extra fields! :partying_face: