+ Reply to Thread
Results 1 to 19 of 19

Search for Keywords and Return the Appropriate Item

  1. #1
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Search for Keywords and Return the Appropriate Item

    Hi everyone. I am having a really tough time figuring out whether this could be done or not, and I am just lost. Basically, we often get mobile phone orders in Excel format but the items listed are in a different format from the ones we have in our inventory system.

    Please refer to the attachment.

    In the Item List tab, you will find under the Item List column, a list of phones as they are named in our inventory system.

    However, in the Order list tab, you will see a list of odered phones that are either named in a different format or are a different variant of the same phone on the Inventory Item list.

    So what I did was create keywords that are associated with a specific phone. So for example, for HTC Touch Dual - P5310 (cell A7 in the Item List tab) , it's associated keywords are:

    P5310 , Touch Dual , and Neon 400 . HTC is the Manufacturer.

    Now in cell A4 of the Order List tab, it says HTC P5310 SIL . This should therefore be assigned HTC Touch Dual - P5310 as per the inventory item list.

    So basically, I was hoping for some formula or macro that would look at the ordered item, then check if it contains the manufacturer name, then check if it contains any one of the keywords, then return the associated inventory item to the cell beside the order item.

    So for HTC P5310 SIL in cell A4 in the Order List tab, it sees that it's manufacturer is HTC ... so now check if it contains any of the keywords. Since it contains P5310, then it has identified that it is an HTC Touch Dual - P5310 as per the inventory item list. And vice versa. The result should be something like in the Result tab.

    I hope I'm not being confusing. Anyways, any assistance would be much appreciated. This is a huge problem for me and I'm getting really really desperate.
    Attached Files Attached Files

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Search for Keywords and Return the Appropriate Item

    Try the attached
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    Quote Originally Posted by millz View Post
    Try the attached
    Holy smokes, looks like it works. I will try it with a larger dataset tomorrow. Awesome awesome! Thank you. Just one question ... is there a way to make it so that doesn't matter whether lower or upper case?

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Search for Keywords and Return the Appropriate Item

    This should ignore casing now
    Attached Files Attached Files

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

    Re: Search for Keywords and Return the Appropriate Item

    This should do what you want and faster when you have bulky data.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    Quote Originally Posted by millz View Post
    This should ignore casing now
    Thank you millz. It works great. I've hit another snag though. I feel terrible for bringing it up.

    Is there a way so that the macro recognizes the keyword if it is within a text string.

    So for example, say the Inventory Item is "HTC X710A Raider LTE" with a keyword "X710A" .

    But say, the Order Item is "HTC Raider(X710A)" .

    Is there a way for the macro to still recognize the keyword "X710A" even though the order item has "(X710A)" instead ?

  7. #7
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    Quote Originally Posted by jindon View Post
    This should do what you want and faster when you have bulky data.
    Thank you Jindon. It works great. I've hit another snag though. I feel terrible for bringing it up.

    Is there a way so that the macro recognizes the keyword if it is within a text string.

    So for example, say the Inventory Item is "HTC X710A Raider LTE" with a keyword "X710A" .

    But say, the Order Item is "HTC Raider(X710A)" .

    Is there a way for the macro to still recognize the keyword "X710A" even though the order item has "(X710A)" instead ?

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

    Re: Search for Keywords and Return the Appropriate Item

    So what would be the logic to determine the keyword?

    Or I should ask why it is not "HTC"?

  9. #9
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    The logic should be that first it should find the manufacturer (HTC). Then it looks for the 1st keyword (X710A). If the manufacturer and 1st keyword are there, then it has determined that the inventory item name should in fact be HTC X710A Raider LTE, as per the inventory item list.

    If the 1st keyword is not found, then it looks for the 2nd keyword (say, Raider). If the manufacturer and 2nd keyword is there then it has determined that the inventory item name is, again, HTC X710A Raider LTE . And so on and so forth.

    The problem is that an ordered item may contain a keyword but have something else attached, like a parenthesis. So an ordered item might look like HTC Raider (X710A) instead of just HTC Raider X710A. The keyword X710A is there, but it isn't recognized because there are parenthesis attached.

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

    Re: Search for Keywords and Return the Appropriate Item

    Then better to post a workbook with all the possible combination example data and the result that you want.

  11. #11
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    Quote Originally Posted by jindon View Post
    Then better to post a workbook with all the possible combination example data and the result that you want.
    Hi Jindon. I have attached a workbook. It also contains the macro that you posted. The desired result is in the Result tab. When I run the macro, it works really well, but hits a snag when it looks at cell A3 in the Order List tab.
    Attached Files Attached Files

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

    Re: Search for Keywords and Return the Appropriate Item

    Try change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    Quote Originally Posted by jindon View Post
    This should do what you want and faster when you have bulky data.
    Hi Jindon. Sorry I have another question if you don't mind. Your code works perfect when the Order List items are in column A. Which part of the code should I modify so that it works if the Order List items are in column L? I just can't seem to figure it out.

    Please Login or Register  to view this content.

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

    Re: Search for Keywords and Return the Appropriate Item

    Try replace all of a(i,2) with a(i,12)

    Otherwise I need to see exact sheet layouts.

  15. #15
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    Quote Originally Posted by jindon View Post
    Try replace all of a(i,2) with a(i,12)

    Otherwise I need to see exact sheet layouts.
    Hi Jindon. Thank you for your speedy reply. I did as you suggested but I get a runtime error 13 type mismatch and this piece of code gets highlighted:

    Please Login or Register  to view this content.
    I have attached the actual workbook I am using.
    Attached Files Attached Files

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

    Re: Search for Keywords and Return the Appropriate Item

    Is this how you wanted?
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    Re: Search for Keywords and Return the Appropriate Item

    Works great. Thank you so much Jindon, you are a genius! I can only hope one day to be as good as you.

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

    Re: Search for Keywords and Return the Appropriate Item

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  19. #19
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Search for Keywords and Return the Appropriate Item

    I am too slow again.. but will post my code to see if I was on the right track..

    I took a different approach.. and made it show multiple matches separated by a "/".

    For example:
    Samsung R351
    showed (in column M)
    Samsung R351 / SAMSUNG LINK SOLO R351 / SAMSUNG LINK R351

    Please Login or Register  to view this content.
    In a Module:
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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] Search for keywords and copy rows containing keywords to new sheet
    By lenorsk in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-15-2013, 06:54 AM
  2. [SOLVED] HDI - Return multiple keywords in a text column based on a set of available keywords
    By zneiley in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-25-2013, 01:32 PM
  3. to return Mutliple results with one search item
    By Bald Ben in forum Excel General
    Replies: 2
    Last Post: 01-14-2011, 04:44 PM
  4. Replies: 12
    Last Post: 10-01-2009, 01:05 PM
  5. Replies: 2
    Last Post: 10-24-2008, 08:36 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