+ Reply to Thread
Results 1 to 6 of 6

Need to remove some contents of a cell.

Hybrid View

  1. #1
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    If a VBA solution is OK, try this UDF:
    Function RemoveToken(sInp As String, iToken As Long, Optional sSep As String = "-") As String
        Dim astr() As String
        Dim i As Long
        Dim n As Long
        
        astr = Split(sInp, sSep)
        If UBound(astr) < iToken - 1 Then
            RemoveToken = sInp
        Else
            For i = iToken - 1 To UBound(astr) - 1
                astr(i) = astr(i + 1)
            Next i
            ReDim Preserve astr(UBound(astr) - 1)
            RemoveToken = Join(astr, sSep)
        End If
    End Function
    Usage for you would be

    =RemoveToken(A2, 6)

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    or
    =LEFT(A1,FIND("/",SUBSTITUTE(A1,"-","/",5))-1)&RIGHT(A1,2)

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Much simpler, Martin.

  4. #4
    Registered User
    Join Date
    01-10-2008
    Posts
    11
    Worked like a charm. Thanks guy's.

+ 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. Need Help testing if a cells contents match that of a cell in another column
    By jmherbert in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2008, 03:56 PM
  2. Excel formulas for checking contents within a cell.?
    By Aubbie in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-02-2008, 03:22 PM
  3. [SOLVED] Using only Excel to reverse the contents of the cell.
    By all4excel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2007, 07:53 AM
  4. cell contents in footer
    By David Obeid in forum Excel General
    Replies: 3
    Last Post: 11-13-2007, 05:20 AM
  5. Remove text after an '&' symbol in a cell
    By Badvgood in forum Excel General
    Replies: 3
    Last Post: 05-13-2007, 03:06 PM

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