+ Reply to Thread
Results 1 to 4 of 4

Silly Excel Formula Question (having a brain freeze moment)

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    Southfield, Michigan
    MS-Off Ver
    Excel 2003
    Posts
    63

    Silly Excel Formula Question (having a brain freeze moment)

    Hi,

    For some reason, I can't recall how to do something that I think is pretty simple in Excel.

    I'm cleaning data (company names in particular) and I'm trying to remove the generic "Co" from the end of a company's name. So I did a simple substitute formula and put a space before "Co" to avoid removing it wholesale from the list. (i.e. "Costco" becoming "st")

    =SUBSTITUTE(A1," Co","")

    Problem is it's also removing "Co" from Company, Corp, Corporation, Cos., Cos, etc.

    So I'm getting "General Motors rporation" or "ABC mpanies"

    I really don't wanna have to write some long string handling formula. (I'm just...not in the mood, lol) but I'm thinking the answer is much simpler, right? Like a wildcard I'm forgetting or something.

    I know someone here knows the answer, lol.

    Thanks!

    R.J.
    Last edited by rjw524; 03-05-2015 at 02:23 PM.

  2. #2
    Registered User
    Join Date
    04-05-2012
    Location
    Southfield, Michigan
    MS-Off Ver
    Excel 2003
    Posts
    63

    Re: Silly Excel Formula Question (having a brain freeze moment)

    I decided to bite the bullet and just do the long formula thingy da**it...

    =TRIM(IF((RIGHT(A2,3)=" Co"),LEFT(TRIM(A2),FIND("~",SUBSTITUTE(A2," ","~",LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))))-1),A2))

    Isn't there a wildcard that means "this text by itself only and not as part of another word"?

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: Silly Excel Formula Question (having a brain freeze moment)

    If it is always at the end of the name, perhaps you can use LEFT up to the last space.

    Hope this helps.

    Pete

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Silly Excel Formula Question (having a brain freeze moment)

    There is no wildcard for not part of another word. Maybe " co " with spaces at both ends is what you are looking for.

    Or
    IF(RIGHT(A1,3)= " co"), LEFT(A1, LEN(A1)-3, IF(ISNUMBER(SEARCH(A1, " co ")), SUBSTITUTE(A1, " co ", ""), A1))
    Last edited by ChemistB; 03-05-2015 at 02:49 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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. Brain Freeze or old age
    By bscs in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-15-2014, 11:17 PM
  2. [SOLVED] SUMIF brain freeze !!
    By andycuk7 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-14-2013, 06:01 AM
  3. Silly Question !!
    By DanielRay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-07-2012, 11:41 AM
  4. Brain Dead at the Moment
    By scottnshelly in forum Excel General
    Replies: 1
    Last Post: 09-26-2006, 06:25 PM
  5. Silly question from a new excel user
    By writingirl007 in forum Excel General
    Replies: 0
    Last Post: 01-13-2005, 11:38 AM

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