+ Reply to Thread
Results 1 to 19 of 19

keyword, matching and breaking up??

  1. #1
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Question keyword, matching and breaking up??

    hi guys,

    I am struggeling with this which I hope you can help...




    I have a work sheet called 'Cross Ref data' which I want to put a keyword in column A (row 1,2,3,4,5,6,7,8 etc)

    I then want to be able to run a macro that will grab the contents of A1 in WS called 'Cross Ref data' and check if it appears in column D and E in WS 'Results'


    If there is a match then for the entire line within WS 'Results' be copied to a WS that already exists called "Cross Ref Results" (please see the below heading '88888***********8888' for the layout)


    If a match appears in both column D and E in the WS 'Results' then only for 1 of the line items to be copied not both (... i do have remove duplicate macro though that does this but it is a bit dirty).



    88888***********8888

    Also, this will make it the best..

    If a match is found for there to be a heading in the "Cross Ref Results" work sheet titled "Found in both" and for the match to upper below.

    If there is not a match for there to be a heading "only appears in your data"

    If for example 10 names are entered in the 'Cross Ref data' WS though there 12 names in the 'Results' WS in column D then the 2 line items can appear under a heading "only appears in XXX"

    The 3 above said heading can be pre populated in the 'Cross Ref data' WS if that makes it easier...

    Thanks soooooo much guys, If this works then i will be over the moon, i hope it can be done.

    thanks
    Last edited by SarahPintal; 01-17-2010 at 07:48 PM. Reason: Solved

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    How about example file showing your setup, and expected results for example data.

    rylo

  3. #3
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    hello again rylo

    sure thing, I have populated dummy data in "sheet2" and "sheet3" .... i have simulated a search and put the searches result in the 'Results' WS.

    I have put some dummy cross reference data in the 'Cross Ref data' WS in which the user would click the button to start the cross reference.

    I have simulated manually what the expected output would be in the 'Cross Ref Results' WS
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    Want to explain how those results in Cross Ref Results were obtained? You have entries for wap7, will and work, but those words don't appear in the Cross Ref Data listing.

    Also the headings found in both and Found in only Results. How are they determined? As you only want to reference Results for your search where does the both come into things? The source sheets? OR both columns D and E?

    rylo

  5. #5
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    Sure,

    your comments:
    You have entries for wap7, will and work, but those words don't appear in the Cross Ref Data listing.

    ans: I need the search to reverse as well.. so it needs to check also if what is in 'Results' (which is actualy a databases tables entries) and what you enter in 'Cross Ref Data' (which is what you expect the database to have, but it doesnt always hence the ability to check from the other direction).

    So you are correct, wap7, will and work appear in 'Results' but not in cross reference. This means that possibly the database as incorrect entries as they do not match up with what the user thinks should be in..


    your comment2:
    Also the headings found in both and Found in only Results. How are they determined? As you only want to reference Results for your search where does the both come into things? The source sheets? OR both columns D and E?

    - As you only want to reference Results for your search where does the both come into things?
    ans: this means that there is a match in both the 'results' & 'cross ref data' WS's when comparing Column D and E.

    Found only in results: means it appears in the results sheet in column D and\or though you didnt not enter it in the 'cross ref data' WS in column A.

    hope that helps rylo, let me know

  6. #6
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    This must be a tricky one! I had a feeling it could be a hardy

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    OK, first cut. Lets see. Also had to keep an eye on the cricket scores....

    Please Login or Register  to view this content.
    rylo

  8. #8
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    thanks rylo,

    from what you coded it almost did every thing that the coded intended. the only thing that happens which should is that one of the headings appears twice -- i have the out put in the attachment.

    Also which im sure you know, the last check which i know isnt in your first draft which is "only appears in cross ref data"


    when the 2 things are above are done then i think it will be 100% what i need!!
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    Oops - missed the bit about the items not found. Think I have the headings resolved. Remember that they have to come from the results sheet headings.

    Please Login or Register  to view this content.
    rylo

  10. #10
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    got an error at this point:

    Please Login or Register  to view this content.
    its right down the bottom when it gets to an item in the 'cross ref data' data WS that isnt in the 'results' WS.


    Also that funky heading issue is still there. I think it is having issues with the last entry and is duplicating it and then creating a new header. (exact same as the last excel doc i attached)

  11. #11
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    Can you send the file you are testing this on, as I am not getting any problems with the original example file.

    rylo

  12. #12
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    this was the error: "the information cannot be pasted because the Copy area nad the paste area are not eh same size and shape."

  13. #13
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    sure thing
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    Here goes for another one. There were a couple of differences between the original file and the one you have used for testing. The header names were different and I was using them as a reference point, and this one only had 1 "NOT FOUND". I should have covered that! but got caught up with the multiple items.

    See how this goes.

    Please Login or Register  to view this content.
    rylo

  15. #15
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    Thanks a heap! this is great.

    Working 100% except for the results duplicated on the results page. I think because it is checking in both columns for a match. I was hoping that if it founds a match that it would move to the next item to find, or, if it found 2 matches that it could be removed. thats okay though I think, I can try and use the remove duplicate sub to fix that up.

    Thanks a always rylo

  16. #16
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    I'm surprised about the duplicate. What it is doing is looking in column D for a match. If it finds one, it marks it as found then moves on. If it doesn't then it looks in column E. If it finds one, it marks it as found then moves on. If it doesn't then it marks it as not found.

    Got an test file that is producing duplicates so I can have a look???

    rylo

  17. #17
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    hey rylo,

    I just figured it out..

    its column A and B... the name columns.

    If the name in Column A is 'Sarah' and in column B on the same line is 'Sarah.com' then both of the lines are copied.

    But it looks like it finds for example 10 matches in column A then loops and finds 10 matches in column B.

    ive just mad a dummy example of test data attached and have also attached the master document.
    Attached Files Attached Files

  18. #18
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: keyword, matching and breaking up??

    Hi

    I've changed sub aaa to removing the casing differences for the INSTR function. See how this goes.

    I've also commented out the call to the progress bar as it isn't really doing what I think you want to do. All it does is run AFTER all the processing has been completed, not AS the processing is being done.

    rylo

    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: keyword, matching and breaking up??

    lol - i did notice the progress bar wasnt doing much, but it did look nice, hehe I guess it slowed the sub down though.

    Thanks so much for all your help ... it worked like a charm. im thrilled

+ 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