+ Reply to Thread
Results 1 to 8 of 8

Replace Text in Cells

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    29

    Replace Text in Cells

    Hi All,

    I am sure this is simple but I have the following information :

    A1

    CISCO SYSTEMS
    Cisco
    HEWLETT-PACKARD
    Hewlett Packard

    What I would like the formula to do is search A1 and if it finds CISCO SYSTEMS make this Cisco, the formula at the same time also needs to check for the word HEWLETT-PACKARD and make this Hewlett Packard.

    So the end result would be:

    B1
    Cisco
    Cisco
    Hewlett Packard
    Hewlett Packard

    I don't want to use search and replace as I am trying to build a sheet with vlookup's etc and want to keep this in a formula or funcation.

    Thanks for your help.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,748

    Re: Replace Text in Cells

    Are these the only two criteria you wish to change or are there more?
    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

  3. #3
    Registered User
    Join Date
    02-05-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Replace Text in Cells

    Hi Alansidman,

    Thanks for the reply.

    For now I only have these but I may wish to add some more depending on the data when it comes to me in RAW format, so making this easy to append to would be great (maybe a VBA script if it's easier) otherwise I guess the lines in the cells could get long!. If you know what I mean....

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Replace Text in Cells

    try this

    =SUBSTITUTE(SUBSTITUTE(PROPER(A1),"Systems",""),"-"," ")

    A
    B
    1
    CISCO SYSTEMS Cisco
    2
    Cisco Cisco
    3
    HEWLETT-PACKARD Hewlett Packard
    4
    Hewlett Packard Hewlett Packard
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,748

    Re: Replace Text in Cells

    Here is one possibility. It is case Sensitive, so if you look for Cisco Systems it will not find it, but if you look for CISCO SYSTEMS, then it will work.

    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

  6. #6
    Registered User
    Join Date
    02-05-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Replace Text in Cells

    Thanks all, works great.

  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: Replace Text in Cells

    did you not consider just find replace?
    find CISCO SYSTEMS
    replace Cisco
    find HEWLETT-PACKARD
    replace Hewlett Packard
    "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
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Replace Text in Cells

    You're welcome and thank you for your feedback!

    Please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ 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. [SOLVED] Replace text for selected cells only
    By Hall in forum Excel General
    Replies: 5
    Last Post: 01-02-2021, 05:11 PM
  2. [SOLVED] Cells values to be check and replace with specific text
    By amolryeolekar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 02:44 AM
  3. Search Cells and Replace Text in that cell
    By lennonjunior in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2009, 11:45 PM
  4. How do I replace the last entire word in text cells?
    By George in forum Excel General
    Replies: 7
    Last Post: 12-15-2005, 05:35 PM
  5. [SOLVED] Find/Replace Text In Cells
    By Rob in forum Excel General
    Replies: 1
    Last Post: 04-10-2005, 11: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