Crystal Reports – finding a domain name from an email address

A client recently wanted to group by only the domain name of email addresses. e.g. would become btinternet and would become jmdtraining

I guess I could have created one long formula but this was my approach.

Formula1Position@ – to find the position of the @ in the email address

instr ({Sheet1_.Email address},”@”  )

Formula2Position. – to find the position of the first . in the email address

instr({Sheet1_.Email address},”.”,1)

Formula 3 – Domain – to isolate the domain name

mid({Sheet1_.Email address},{@Position@}+1,{@Position.}-{@Position@}-1)

In all cases replace Sheet1_.Email address with your email address field.

Find out more about our Crystal Reports training London, Middlesex and Surrey areas or our Crystal Reports training Dorset, Hampshire, Wiltshire.



About jdonbavand

I am a trainer of Microsoft Office, Microsoft Project and Crystal Reports. I have called my blog "If Only I'd Known That...." because I hear it so many times in training sessions. In fact, if only I had a £100 (or 150 Aussie dollars)for every time someone says "If only I'd known that." ....
This entry was posted in Crystal Reports, Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s