+ Reply to Thread
Results 1 to 6 of 6

Find values in a column that do not match values in another column

  1. #1
    Registered User
    Join Date
    09-24-2014
    Location
    NC
    MS-Off Ver
    2010
    Posts
    10

    Find values in a column that do not match values in another column

    I have a sheet with multiple columns with one column containing "City, State" combinations. These are from manual input so there are many misspellings (file provided to me so I can't address data validation, just have to fix what I get). On a second sheet I have a master column of all correctly spelled locations. My goal is to search the City/State column and compare to the master column and for any value found that is not in the master column (i.e., a misspelling), fix it. Before tackling how to fix problems found, I am trying to just find the misspelled cells and write the misspelling and row number somewhere. I'm just learning VBA so after searching and finding many different solutions, I tried to adapt the few I could actually understand. But I get a type mismatch in the "itemfound = ..." line.

    I suspect this should be easy to figure out, but I'm stumped. Honestly, I understand most of what is going on here, but the bit I don't has hindered my ability to figure it out.

    Thanks for any direction.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Find values in a column that do not match values in another column

    Hi there,

    Just a comment, not tested, as it's late here

    You've declared the variable itemfound as being of type Boolean, but it looks as if the following code will attempt to return a String (text) value to that variable:

    Please Login or Register  to view this content.

    Try declaring itemfound as a String variable and see what happens.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Find values in a column that do not match values in another column

    Please post an example file with just the 2 columns that need to be compared so we can start from there.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    09-24-2014
    Location
    NC
    MS-Off Ver
    2010
    Posts
    10

    Re: Find values in a column that do not match values in another column

    Tried String and still a problem. Tried a variety of other things and just confused myself worse.

    Seems it is a type mismatch with the array, but I don't know enough to know what the problem or fix is. Attached is what I have.

    Thanks.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Find values in a column that do not match values in another column

    No vba
    1) Enter B2 in "DataDump", =MATCH(A2,StoreLocations!$B$1:$B$30,0) and copy down to the end
    2) Autofilter colB by #N/A

    That will give you the result that you want.

    If vba, result in colC
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-24-2014
    Location
    NC
    MS-Off Ver
    2010
    Posts
    10

    Re: Find values in a column that do not match values in another column

    Thank you, this works. It will take some studying and research for me to understand what it is doing so I can move to my next step of automating the correction of these errors. Perhaps some sort of fuzzy matching.

    Thanks again.

+ 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. Replies: 5
    Last Post: 03-03-2016, 10:52 AM
  2. [SOLVED] Find Values in Column A and fill identical values in Column B
    By deviltronics in forum Excel General
    Replies: 6
    Last Post: 10-07-2014, 05:25 PM
  3. Replies: 3
    Last Post: 01-03-2014, 08:03 PM
  4. Replies: 2
    Last Post: 12-30-2013, 08:15 AM
  5. How do i find the max of two values from index match max of a column
    By mohaymin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-09-2013, 02:04 PM
  6. How to find a column match and paste values
    By dwx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2013, 12:56 PM
  7. Replies: 2
    Last Post: 10-08-2012, 02:17 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