+ Reply to Thread
Results 1 to 12 of 12

How to remove two specific words from each cell in a column

  1. #1
    Forum Contributor
    Join Date
    04-09-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2007
    Posts
    117

    How to remove two specific words from each cell in a column

    Dear All,
    I have a column with almost 1000 rows and in each cell there is a company name followed by: - price high
    So, for example, it could be INDO TECH TRANSFORMERS - PRICE HIGH
    or INDO GULF DEAD - 04/03/03 - PRICE HIGH

    I just need to remove - Price High and leave the rest same. If for some reason, there is no price high in that cell, I dont want to change anything in that case.
    Most of the formulas I have come across to solve a problem like this focus on removing last two words or characters, but I only want to remove these particular words which though in most cases are the last two words only.

    Thanks a lot in advance you wonderful people!

  2. #2
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: How to remove two specific words from each cell in a column

    If A1="INDO TECH TRANSFORMERS - PRICE HIGH"

    Then in B1 use this formula... =IF(RIGHT(A1,10)="PRICE HIGH",LEFT(A1,LEN(A1)-13),A1)

  3. #3
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Mexico
    Posts
    200

    Re: How to remove two specific words from each cell in a column

    Might try Find and Replace.

  4. #4
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: How to remove two specific words from each cell in a column

    Hi pahari75

    Another version and "- PRICE HIGH" can be anywhere in the string:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

  5. #5
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: How to remove two specific words from each cell in a column

    =substitute(a1,"- price high","")

  6. #6
    Forum Contributor
    Join Date
    04-09-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2007
    Posts
    117

    Re: How to remove two specific words from each cell in a column

    Thanks so much. They all work fine. Unfortunately the reason for which i wanted to do this is not working now. Ok, let me explain. There are two columns with 1000+ company names in each column. In the first column, company names are followed by price high as I explained above. In the second column, most of the company names are same as first column except that they dont have price high after the name. That's why I wanted to remove price high and then match the two columns to spot some unique company names in both columns. After I removed price high, I did a conditional formatting and tried to highlight the duplicate values. I was convinced that since the company names are now same, it should be fine. But somehow its not doing that-even though the names are exact in both columns like below.

    HIND SYNTEX HIND SYNTEX

    HINDITRON TEKTRONIX DEAD - 03/02/99 HINDITRON TEKTRONIX DEAD - 03/02/99

    Any thoughts why its not working or perhaps there is any other way to do this?
    Thanks so much.

  7. #7
    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 remove two specific words from each cell in a column

    what did you use for conditional formatting?
    "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

  8. #8
    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,929

    Re: How to remove two specific words from each cell in a column

    check for leading/traling spaces.

    If you can find a pair that appear identical, but your method is not high-lightling, tstthat they are idemtical using =exact() FALSE means they do not match
    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

  9. #9
    Forum Contributor
    Join Date
    04-09-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2007
    Posts
    117

    Re: How to remove two specific words from each cell in a column

    I guess as martin mentioned, there are perhaps spaces in one cell which prevent from seeing both as same. How to get around that? Perhaps deleting all such spaces first? Thanks.

  10. #10
    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,929

    Re: How to remove two specific words from each cell in a column

    getting rid of those spaces should help, but if you have a lot of entires, that would become very tedious.

    Can you upload a sample of the "duplicate/not matching data?
    depending on which column has the spaces and which column you are searching INTO, maybe something like...

    =VLOOKUP("*"&D22&"*",C21:C23,1,FALSE)
    this will seach for abc with NO leading/reailing spaces in a range that contains " abc " with trailing leading spaces

    Alternatively, =VLOOKUP(TRIM(C22),D21:D23,1,FALSE) will search for text that contains leading/traling spaces in a range that has data with no spaces

  11. #11
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: How to remove two specific words from each cell in a column

    Hi pahari,

    If you are using Kevin's or Ghozi's formulas, then you must change "- price high" to " - price high"... they were missing an extra "space" before the dash...

  12. #12
    Forum Contributor
    Join Date
    04-09-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2007
    Posts
    117

    Re: How to remove two specific words from each cell in a column

    Thanks guys. Djapigo, yes it worked now! Thanks so much!

+ 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