+ Reply to Thread
Results 1 to 7 of 7

Removing a Prefix from Text in a Cell

  1. #1
    Registered User
    Join Date
    03-22-2004
    Posts
    6

    Removing a Prefix from Text in a Cell

    Hi, is there anyway that I can automatically remove a prefix from text in a cell. For example, I have the following text in a cell:- CNHP92274A and I wish the remove the CNHP so that I end up with:- 92274A. Any help would be most appreciatted.

    Thanks, Ciaron

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Is your prefix always 4 characters long, and do you need the "-"?

  3. #3
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    You could try this, with you text in A1, put this in B1

    =RIGHT(A1,6)
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    You can use a helper column. Say your data in Col A enter either of these in B1 and drag down

    =SUBSTITUTE(A1,"CNHP","")

    or

    =RIGHT(A1,LEN(A1)-4)

    Then copy col B and Paste special values .

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Registered User
    Join Date
    03-22-2004
    Posts
    6
    hi, the formula =RIGHT(A288,LEN(A288)-4) worked the bomb, thanks very much

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    If you just want to remove the 1st four characters then another way is

    =REPLACE(A288,1,4,"")

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad you found a solution

    VBA Noob

+ 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