+ Reply to Thread
Results 1 to 3 of 3

deleting part of a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    01-19-2010
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    4

    deleting part of a cell

    Hello

    I have a huge Excel database of 10000 email addresses, and in order to import them in to my email accounts address book, I need to remove the the persons name so I am just left with the email address.

    ie;

    (All in one cell)
    John Smith <johnsmith@help.co.uk>

    needs to become

    <johnsmith@help.co.uk>

    I am wondering if there is an action or something that I can run so I don't have to delete each name by hand more than 1000 times?

    Hope someone can help.

    Kind Regards

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: deleting part of a cell

    Hi,

    Use a helper column and use

    =RIGHT(A1,LEN(A1)-FIND("<",A1)+1)
    Copy this down your 1000+ rows then if necessary copy and paste special on top of the original data.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: deleting part of a cell

    Here's a User Defined Function
    '---------------------------------------------------------------------------------------
    ' Module    : Module1
    ' Author    : Roy Cox
    ' Date      : 26/07/2008
    ' Purpose   : Extract email address from string
    '---------------------------------------------------------------------------------------
    
    Option Explicit
    
    Function GetMailAdd(rCl As Range) As String
    
        Dim sText As String
        Dim iStart As Integer
        Dim iEnd As Integer
        Dim iPos As Integer
    
        On Error GoTo GetMailAdd_Error
    
        sText = rCl.Text
        iPos = InStr(1, sText, "@")
        iStart = InStrRev(sText, " ", iPos)
        If iStart = 0 Then iStart = 1
        iEnd = InStr(iPos, sText, " ")
        If iEnd = 0 Then iEnd = Len(sText) + 1
    
        GetMailAdd = Trim(Mid(sText, iStart, iEnd - iStart))
    
        If Right(GetMailAdd, 1) = "." Then
            GetMailAdd Left(GetMailAdd, Len(GetMailAdd) - 1)
        Else
            GetMailAdd = GetMailAdd
        End If
    
        On Error GoTo 0
        Exit Function
    
    GetMailAdd_Error:
    
        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure GetMailAdd of Module Module1"
    End Function
    Use as an ordinary function

    =getmailadd(A1)
    Last edited by royUK; 01-19-2010 at 08:24 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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