+ Reply to Thread
Results 1 to 7 of 7

SUBSTITUTE Function for a range

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question SUBSTITUTE Function for a range

    Hi,
    I need some help, I am trying to use the SUBSTITUTE formula to find any instance of a misspelled name and have it substitute in the correct spelling. This stems from an error where two areas I am pulling information from have slightly different spellings of the same name and I need them to match so that a another formula that pulls information from the sheet will function properly. So for example sheet A pulls information from sheet B and C and matches them, since the information in sheet B for this entry is spelled wrong is does not match. So how can I have it look for any instance of the misspelling in sheet B and replace it with the correct version? I thought it would be simpler and tried using
    =SUBSTITUTE(A1:A500, "old_text","new_text")

    So I am using the range of the area the name could appear in and had old text as the misspelled name, then the new text as the correct spelling I need it to be, but it just isn't working. I left out the instance number since I want it to correct any time it happens and that could vary depending on the day since this is in a template that is used daily. My problem may also be that, since I have to dump new data pulled from a CSV into this sheet everyday I didn't want the formula to be in the cells themselves (as they would be wiped out daily) and have it put in under conditional formatting for that range, using that formula.

    Please help! This error is something I can not fix as it is incorrectly named from another source I have no control over and I do not wish to have to do a find and replace every day when using this template. Thanks.

  2. #2
    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,933

    Re: SUBSTITUTE Function for a range

    Hi and welcome to the forum

    =SUBSTITUTE() works on a cell, not a range You would need to copy this down to have it applied to every cell. Im not sure what your 2 words would look like, but 2 options come to mind...Find/Replace or using wildcards in the match

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    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

  3. #3
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: SUBSTITUTE Function for a range

    Well, to be honest with you... accounting for typos in data is extremely difficult to handle... I mean, how does excel know whether or not a word or name is spelled incorrectly? And if the spelling on sheets B and C is different, how does Excel know which one is spelled correctly so it substitutes the correct one over the incorrect one?

    Your situation would be better handled with proper data input controls... but as you say, since you have no control over that, you are left to process the data daily.

    - Moo

  4. #4
    Registered User
    Join Date
    02-10-2014
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: SUBSTITUTE Function for a range

    ExampleWorkBook.xlsx

    Okay I have attached an example to try and illustrate what I am working with. Everyday as part of an end of day retouine myself or another has to complete a much more detailed version of this workbook. In the "CSV_1" sheet we paste in information from a CSV of what information is *supposed* to be used for the day in question. In "CSV_2" we paste in information from a CSV of what *actually* was used. Then on the "Daily_Checkout" we confirm if they match or not. You will see green "Y" means they match, red means they do not match. But the issue in question shows up as "#N/A" because of the difference in the name in the two CSV areas. In one the name ends with ".net" where in the other (and all other sheets for other areas that are not included) it ends with ".com" The issue only arises in this sheet because of an issue with a certain CSV, this CSV is provided by another company I work with who is aware of the issue but does not care to correct it as they do not see it as causing any issues.

    Hopefully this helps, again since this is something we must every do everyday to ensure the work we do is completed correctly it would be helpful to have something that automatically changes any instance of the name in "CSV_1" to the correct name so that on "Daily_Checkout" we could easily see if they match or not.

  5. #5
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: SUBSTITUTE Function for a range

    Try to do it this way:
    CTRL H Find (.net) and replace (.com)
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  6. #6
    Registered User
    Join Date
    02-10-2014
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: SUBSTITUTE Function for a range

    Quote Originally Posted by popipipo View Post
    Try to do it this way:
    CTRL H Find (.net) and replace (.com)
    As stated in the original post I would like to avoid having to find and replace everyday and would like to find a way that it would automatically replace all occurrences

  7. #7
    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: SUBSTITUTE Function for a range

    Maybe this

    in C3 and copy formula down

    =IFERROR(VLOOKUP(A3,CSV_2!$E$3:$O$200,11,FALSE),B3)
    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

+ 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] SUBSTITUTE Function
    By Onceageordie in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-23-2013, 09:26 AM
  2. [SOLVED] Substitute Formula for Cell ID in Range
    By jerry.fein in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-21-2013, 01:19 PM
  3. Substitute for Range function
    By joey1984 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2013, 01:54 AM
  4. substitute function
    By mrggutz in forum Excel General
    Replies: 2
    Last Post: 02-18-2011, 08:54 AM
  5. substitute in sum on range
    By Luminary Xion in forum Excel General
    Replies: 1
    Last Post: 03-11-2008, 09:17 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