+ Reply to Thread
Results 1 to 5 of 5

Find and Replace Query

  1. #1
    Registered User
    Join Date
    11-19-2010
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Find and Replace Query

    Hi,

    I'm using Office 2007 and have an Excel query.

    I downloaded a sales report and where there is a description of the goods, I need to shorten it to two words but cannot seem to do this with Find and Replace.

    For example I might want to replace these three descriptions :

    A box of blue widgets
    Twenty Five Blue Widgets from New York
    Blue Widgets with a dash of green

    with:

    "Blue Widgets"

    Essentially, is there a way of highlighting all the columns that contain a phrase, like "Blue Widgets"with other words at the beginning and end and then replace them with just the phrase "Blue Widgets"

    I hope this makes sense

  2. #2
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Find and Replace Query

    Hi

    The following code is adapted from the VBA help example and the main point to note is LookAt:=xlpart, which checks for any occurrence of the string within the text.

    Please Login or Register  to view this content.
    Regards

    Jeff

  3. #3
    Registered User
    Join Date
    11-19-2010
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Find and Replace Query

    Hi Jeff,

    Thanks for your response, I'm afraid I am very new to Excel!

    I pasted "lookat:=xlPart" into a cell but nothing happened, as I say, I don't know what I'm doing.

    Is there no simple way of doing a Find & Replace and stripping out blocks of text and replacing them with other words?

    The way I've been doing it is to click Control+F (Find), then type in my phrase to find cells where it occurs and then click Control+V with my one word phrase.
    Because there are hundreds of cells, this takes hours!

    All the best,
    Derrick

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

    Re: Find and Replace Query

    use find replace
    find
    *blue widgets*
    replace
    blue widgets
    "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

  5. #5
    Registered User
    Join Date
    11-19-2010
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Find and Replace Query

    Quote Originally Posted by martindwilson View Post
    use find replace
    find
    *blue widgets*
    replace
    blue widgets

    That works perfectly!
    So the * seems to be the key to it.

    Cheers!
    Derrick

+ 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