+ Reply to Thread
Results 1 to 15 of 15

Pulling email address from irrelevant data within cell and inserting in adjacent column

  1. #1
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Pulling email address from irrelevant data within cell and inserting in adjacent column

    I have a limited background in VB and am looking for an easy way to sort through a column containing upwards of 800 cells. Each cell has a bunch of irrelevant information mixed around the email address I'm looking to pull from the cell.

    Example (cell A1):

    Sample message used here to show info|
    More sample information that I do not need|
    You get the point, I don't need this information|
    [email protected] 8282013 random information here

    All I need in cell B1 would be: [email protected]

    All help would be greatly appreciated!

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Hi and welcome to the forum,
    This function will return the email address found in the cell using a simplified RegEx expression :

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    I should clarify, when I said I have limited background in VB I meant I have almost no background in VB.

    I've entered in the code and when I run it, it prompts me to name it which I will name 'test' for simplicity. I then create it which then prompts a window for Module1 starting with:

    Sub test()

    End Sub

    What should I put in the Sub?

    Sorry, I'm a noob

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    You need to copy the code in a module. To do so.
    - from excel, ALT + F11 to open the VBE editor
    - ALT, I, M to insert a new module
    - copy the code there (in the white section).

    The code I provided is a function. Go in B1 and type =FindEmail(A1) and if there is an email address in A1 you will get the result.
    Copy the formula down.

    Instead of a Function, the code could be re-written as a procedure (Sub) to loop through all cells and write the result back.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    http://www.mrexcel.com/forum/excel-q...il-cell-3.html

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jindon; 09-05-2013 at 03:38 PM.

  6. #6
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    I tried that and I got #VALUE!. As far as the attachment goes, I am unable to open it on my current machine. Not sure if its because I'm on Excel 2000 but I have a feeling that it is.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    File attached to my previous post.

  8. #8
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Thank, this is a big improvement. There may be some fine tuning needed however. I'll use an example from a cell with names changed below.

    Cell A1:
    This is the message at sample.server.server.net.
    I'm sorry to inform you that the message below could not be delivered.
    When delivery was attempted, the following error was returned.
    <[email protected]>: host 00.00.000.000

    Cell B1 [=FindEmail(A1)]:
    [email protected]>: host 00.00.000.000

    Unfortunately there is no pattern of how cells in column A contain the email; in some the email is between <> and others between '' or have no separators at all.

    Make no mistake, this is a big improve and if this is as good as it can get, I'll be happy with that!

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Can you upload a small sample workbook showing possible patterns of your data?

  10. #10
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    I'll try, there's sensitive information contained within though so I have to change some names and whatnot.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Just delete "^" from the pattern...
    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Not every cell contains emails and that is fine. There are over 800 of these so I can't say for sure if they are similar to these obviously. These are all essentially bad email addresses from a mass emailing.
    Attached Files Attached Files
    Last edited by SouthFloridaBadger; 09-07-2013 at 08:49 PM.

  13. #13
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Quote Originally Posted by jindon View Post
    Just delete "^" from the pattern...
    Please Login or Register  to view this content.
    This works perfectly! Thank you very much!

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Just let you know that it will not recognize a string like

    abc(xyz)@abc.com

    as invalid character used.

  15. #15
    Registered User
    Join Date
    09-04-2013
    Location
    Miami, FL
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Pulling email address from irrelevant data within cell and inserting in adjacent colum

    Quote Originally Posted by jindon View Post
    Just let you know that it will not recognize a string like

    abc(xyz)@abc.com

    as invalid character used.
    I don't think we will run into too many errors with that but I'll be double checking all the cells where an email isn't generated. Thank you so much for the help, it is greatly appreciated!

+ 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. Replies: 4
    Last Post: 08-14-2013, 12:02 PM
  2. Trouble Finding tring in Column and Pulling Adjacent Cell Value
    By rlee12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2013, 09:48 AM
  3. [SOLVED] Extracting email chain email address and converting to Excel column
    By Leah_Hael in forum Excel General
    Replies: 4
    Last Post: 12-28-2012, 04:05 PM
  4. Replies: 1
    Last Post: 03-08-2012, 01:57 PM
  5. can I copy a column of email addresses, paste into email address?
    By Lizizfree in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-20-2006, 05:05 PM

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