+ Reply to Thread
Results 1 to 10 of 10

Removing words under 4 letters

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Bellevue, WA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Removing words under 4 letters

    Hi, I am trying to figure out how to remove words that are shorter than 4 letters long from my data.

    I only have one column starting at A2 (there is a header in A1).

    Any help on this ASAP would be greatly appreciated.

    Thanks

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Removing words under 4 letters

    Hi and welcome to the forum

    I think you need to explain in a bit more detail what you mean? is this words within a string, single words in a cell etc?

    Perhaps provide a few samples of what you have and what you want?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Removing words under 4 letters

    If you only need to do it once, try inserting this formula in B2: =LEN(A2)
    Copy the formula to the last row, then filter for those with 1, 2, 3, and delete accordingly.

  4. #4
    Registered User
    Join Date
    10-29-2013
    Location
    Bellevue, WA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Removing words under 4 letters

    Thanks!

    I have sentences in each cell, for example: The alligator was swimming in the swamp. I want to remove words shorter than 4 letters so I want it to just display alligator swimming swamp.

  5. #5
    Registered User
    Join Date
    10-29-2013
    Location
    Bellevue, WA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Removing words under 4 letters

    I have almost 17,000 rows to do this for. How do I filter to show only the words that are 1,2,3 letters long?

  6. #6
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Removing words under 4 letters

    Try using this UDF. Place it in a module in the workbook, and in cell B2, enter: =RemoveWords(A2)
    and copy the formula to the last row.

    Please Login or Register  to view this content.
    Last edited by millz; 10-29-2013 at 11:28 PM.

  7. #7
    Registered User
    Join Date
    10-29-2013
    Location
    Bellevue, WA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Removing words under 4 letters

    Quote Originally Posted by millz View Post
    Try using this UDF. Place it in a module in the workbook, and in cell B2, enter: =RemoveWords(A2)
    and copy the formula to the last row.

    Please Login or Register  to view this content.
    When I hit F5 to run it, it says Ambiguous Name Detected RemoveWords.

  8. #8
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Removing words under 4 letters

    Not exactly sure why you had to hit F5.

    See attached sample.
    Attached Files Attached Files

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

    Re: Removing words under 4 letters

    Hello,
    Ambiguous name detected means you have 2 or more functions / sub with the same name (RemoveWords).

    Other solution using Regular Expression. Select Range and run the macro :
    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.

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

    Re: Removing words under 4 letters

    Quote Originally Posted by jeremyh09 View Post
    I have almost 17,000 rows to do this for.
    Try this
    Please Login or Register  to view this content.

+ 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. COMBINE LETTERS into WORDS
    By JPSQ in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-24-2022, 07:52 PM
  2. Removing letters only at the end of a cell
    By raynold in forum Excel General
    Replies: 3
    Last Post: 03-06-2012, 05:49 PM
  3. Removing letters in a cell
    By btnhtillidie in forum Excel General
    Replies: 5
    Last Post: 04-14-2010, 10:33 PM
  4. VB - Making first letters of words uppercase
    By Smurlos in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2010, 08:10 PM
  5. [SOLVED] Removing all rows that contain letters
    By fred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2005, 12: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