+ Reply to Thread
Results 1 to 13 of 13

how to delete first 4 characters in a cell?

  1. #1
    Forum Contributor
    Join Date
    05-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    145

    how to delete first 4 characters in a cell?

    Guys,
    I have a simple question: I have a single column with text values.
    Each cell has 4 non useful characters: 3 numbers and a comma (,) - see file attached
    Is there any way to remove this 4 characters in each cell, using a formula or a macro?
    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: how to delete first 4 characters in a cell?

    use a helper column, then copy paste values back over original data.

    =MID(A1,5,LEN(A1))
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: how to delete first 4 characters in a cell?

    A non formula solution

    Select data
    Menu Data - text to columns
    Select delimited - Next
    Check commas - Next
    Check " do not import column after selecting the first column ( automatic)
    Finish

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: how to delete first 4 characters in a cell?

    Note that the text to columns approach will split up some the the records futher down into multiple cells.

  5. #5
    Forum Contributor
    Join Date
    05-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    145

    Re: how to delete first 4 characters in a cell?

    Dear Andy - your formula works like charm - thanks a lot
    However, a macro might be more useful for me
    I am using the "personal" sheet in the excel startup folder and I am adding all my useful macro's there so that it stay handy
    Is there a way to do the same thing using a macro?

    Quote Originally Posted by Andy Pope View Post
    use a helper column, then copy paste values back over original data.

    =MID(A1,5,LEN(A1))

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: how to delete first 4 characters in a cell?

    Good point Andy

    To avoid this use " fixed width" instead of "delimited"

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: how to delete first 4 characters in a cell?

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    145

    Re: how to delete first 4 characters in a cell?

    Thanks Arthur!
    But like I asked Andy: is there a way to do this using a macro?

    Quote Originally Posted by arthurbr View Post
    Good point Andy

    To avoid this use " fixed width" instead of "delimited"

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: how to delete first 4 characters in a cell?

    Actually do you really want to remove the first 4 characters?

    What about this record

    84,acupuncture Alabama

    The returned value would be

    cupuncture Alabama

    Maybe you want to remove characters up to the first comma?

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    05-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    145

    Re: how to delete first 4 characters in a cell?

    PERFECT
    Andy, I do appreciate this!
    Sami

    Quote Originally Posted by Andy Pope View Post
    Please Login or Register  to view this content.

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

    Re: how to delete first 4 characters in a cell?

    given your example has only one comma use find replace
    find *, replace with nothing
    "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

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: how to delete first 4 characters in a cell?

    There are records with multiple commas that will be wrecked.

    335,acupuncture+St. Louis,,,, Louis
    375,acupuncture+St. Paul,,,, Paul
    377,acupuncture+St. Petersburg,,,, Petersburg
    490,aircraft +St. Petersburg,,,, Petersburg
    491,aircraft +St. Paul,,,, Paul
    492,aircraft +St. Louis,,,, Louis
    619,acupunctureSt. Petersburg,,,, Petersburg
    620,acupunctureSt. Paul,,,, Paul
    621,acupunctureSt. Louis,,,, Louis
    672,St. Paul,,,, Paul
    674,St. Louis,,,, Louis
    685,St. Petersburg,,,, Petersburg
    823,aircraft St. Louis,,,, Louis
    833,aircraft St. Paul,,,, Paul
    834,aircraft St. Petersburg,,,, Petersburg

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

    Re: how to delete first 4 characters in a cell?

    didnt see those lol

+ 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