+ Reply to Thread
Results 1 to 8 of 8

parsing email address into three separare fields using formulas

  1. #1
    Registered User
    Join Date
    08-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    parsing email address into three separare fields using formulas

    HI, I'm trying to use formulas to separate email addresses in a list into three component parts: first name, last name, company name.

    For example, [email protected] into "hazel", "jones" and "mycompany"


    I have managed to use formulae to parse the first name and the company name, but I am having trouble getting consistent results to get the last name.



    The email address is in, say, cell C2

    For first name I use:
    =LEFT(C2,FIND(".",C2,1)-1)

    For company name I use:
    =RIGHT($c2,15) (Fortunately it's the same 15 letter company name each time, I'm doing this part to check for typos)

    For the last name I couldn't work out a way of using C2. Instead, I first used another formula to put the data before the "@" into a column of it's own.... =LEFT(C2,FIND("@",C2,1)-1) which gave me, for example, hazel.jones
    I then tried to use the RIGHT function to on this new cell, to get the last name. The fomula I tried was =RIGHT(Y2,FIND(".",Y2,1)-1) but this gave me inconsistent results down the list of names. Sometimes I got the "." included; sometimes I got the correct last name; sometimes I got only part of the last name.

    I tried changing the -1 to other values, both positive and negative. This gave me different results, but the results were not consistent in the list.

    I know that I can manually parse the data, but I'd really like to do this as a formula so I don't have to parse each time I put new names in the list.

    Can anyone help me please?

    Thanks in anticipation

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: parsing email address into three separare fields using formulas

    not all email addresses are in that format
    [email protected]
    [email protected]
    [email protected]
    [email protected]
    [email protected]

    for example
    how would you deal with them?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    08-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: parsing email address into three separare fields using formulas

    Quote Originally Posted by martindwilson View Post
    not all email addresses are in that format
    [email protected]
    [email protected]
    [email protected]
    [email protected]
    [email protected]

    for example
    how would you deal with them?
    There company does not use _ in their email addresses. I might in theory have some instances of the [email protected] issues. I guess the ideal solution would be to work backwards from the "@" sign to the ".". But I don't know how to do that.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: parsing email address into three separare fields using formulas

    lets assume you can only have these 2 formats

    [email protected]
    [email protected]
    with address in a1 then
    b1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    c1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    d1

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: parsing email address into three separare fields using formulas

    Thank you, that works perfectly
    Last edited by dannahaz; 08-17-2013 at 06:11 AM.

  6. #6
    Registered User
    Join Date
    08-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: parsing email address into three separare fields using formulas

    Dup Post, sorry

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: parsing email address into three separare fields using formulas

    not in mine it doesnt
    Attached Files Attached Files

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: parsing email address into three separare fields using formulas

    Ifyou want to split at every dot and @ try this, drag across until blanks are returned
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Mandatory Fields before submitting worksheet to email address
    By lisbradley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2013, 07:57 PM
  2. need to add multiple email address fields to an existing macro
    By kiranpat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2013, 01:37 PM
  3. Replies: 1
    Last Post: 03-08-2012, 01:57 PM
  4. Parsing Email Address from cell
    By Highbury_White in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-25-2008, 11:14 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1