Capture the domain name from a url field (website) in a formula
e.g. If the url is https://na9.salesforce.com it should be salesforce
SUBSTITUTE(
IF(
FIND(
"/",
IF(
FIND("www.", Website) > 0,
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//www.", Website) + 5), NULL),
Website
),
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//", Website) + 1), NULL),
Website
)
)
) > 0,
LEFT(
IF(
FIND("www.", Website) > 0,
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//www.",Website) + 5), NULL),
Website
),
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//",Website) + 1), NULL),
Website
)
),
FIND(
"/",
IF(
FIND("www.", Website) > 0,
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//www.",Website) + 5), NULL),
Website
),
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//", Website) + 1), NULL),
Website
)
)
) - 1
),
IF(
FIND("www.", Website) > 0,
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//www.", Website) + 5), NULL),
Website
),
IF(
FIND("//", Website) > 0,
SUBSTITUTE(Website, LEFT(Website, FIND("//", Website) + 1), NULL),
Website
)
)
),
'www.',
''
)
Comments
Post a Comment