How to extract or parse first part or Domain name from Standard/Custom Email Field or Username
|Knowledge Article Number||000213903|
|Description||This article explains how to extract either the domain name or the part before the @-sign for either usernames or email-addresses
For e.g. Abc@salesforce.com is the email ID. The domain is 'Salesforce.com'
The part in front of the @-sign is 'Abc'
A third formula is provided to just get 'salesforce', without the domain extension.
|Resolution||In this formula we use LEFT, to get the left part of the field, up to Finding the @-sign
User part extraction from Email Field :
LEFT( Email , FIND( "@", Email ) - 1 )User part extraction from Username Field :
LEFT( Username , FIND( "@", Username ) - 1 )
In this formula we use RIGHT, to get the right part of the field, calculating the length, by subtracting the location of the @-sign, from the LEN(gth) of the field
Domain Extension Extraction from Email Field :
RIGHT ( Email, LEN ( Email ) - FIND( "@", Email ) )Domain Extension Extraction from Username Field :
RIGHT ( Username, LEN ( Username ) - FIND( "@", Username ) )
Taking out just the company name, or the Domain name without the domain extension, is a bit more complicated. The following formula, searches for the @-sign, and starts collecting just after it, then searches for the first dot after the @-sign, and calculates how many characters we want.
Extraction of main Domain part from Email Field :
MID ( Email, FIND( "@", Email) + 1 , FIND ( ".", Email, FIND( "@", Email) ) - 1 - FIND( "@", Email) )Extraction of main Domain part from Username Field :
MID ( Username, FIND( "@", Username ) + 1 , FIND ( ".", Username, FIND( "@", Username ) ) - 1 - FIND( "@", Username ) )