+ Reply to Thread
Results 1 to 5 of 5

Delete everything after the last special character

  1. #1
    Registered User
    Join Date
    04-27-2017
    Location
    New York
    MS-Off Ver
    MS 365 v2211
    Posts
    85

    Delete everything after the last special character

    Hello, I am working with a spreadsheet that contains names of clients in one column, but their names have been merged with various service types and locations.

    The basic pattern is that anything right of the last " -" can be deleted (that's a space and a hyphen). The trick is that there may be additional spaces and hyphens, but they can stay. Also, not every cell contains a hyphen at all. Some are fine as-is.

    Any takers on helping me puzzle this one out? I mirrored something similar from online and got close, but not 100%.

    Thanks for taking the time,
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Delete everything after the last special character

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: Delete everything after the last special character

    Power Query Option

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    04-27-2017
    Location
    New York
    MS-Off Ver
    MS 365 v2211
    Posts
    85

    Re: Delete everything after the last special character

    Wow, Fluff's solution did the trick. I just added a space before the hyphen, within the quotes.

    Alan, I like that idea of learning PQ. Just gotta get management to agree that it's the right tool for us.

    Thank you,

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Delete everything after the last special character

    Glad to help & thanks for the feedback.

+ 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. Replies: 3
    Last Post: 09-08-2022, 02:30 AM
  2. VBA function: Insert character every X special character
    By Ralleberg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2022, 09:28 AM
  3. [SOLVED] Special Character
    By wacky_diva in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2016, 12:48 AM
  4. Delete Row with string containing special character
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-24-2014, 06:02 PM
  5. Need to highlight special character and the cells contains special character
    By dhilipan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2013, 01:36 AM
  6. [SOLVED] Delete row that contains special character *
    By canada123 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-17-2013, 12:25 PM
  7. Macro to find character and delete all text in cell after the character
    By SpencerRichman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2012, 06:08 PM

Tags for this Thread

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