+ Reply to Thread
Results 1 to 4 of 4

How to get different outputs from sets of keywords

Hybrid View

  1. #1
    Registered User
    Join Date
    10-29-2011
    Location
    Ldn
    MS-Off Ver
    Excel 2003
    Posts
    5

    How to get different outputs from sets of keywords

    So I have a table of roughly 200 internet search keywords from two different companies, which I want to sort. One is Walmart the other is Costco.
    So keywords might look something like this:
    "Walmart Canada"
    "Walmart groceries"
    "Walmart"
    "Costco Canada"
    "Costco"
    "Costco bulk prices"
    and so on.

    In column B, I want to display the following numbers: 1 if it refers to Walmart, 2 if it refers to Costco and 3 if it contain a keyword that refers to BOTH. So in this case it should show:
    3 (Canada it common to both)
    1
    1
    3 (Canada is common to both)
    2
    2

    What I'm having trouble with is displaying the 3's. These are different approaches I've been taking:
    =IF(ISNA(VLOOKUP("walmart",A3:C103,1,FALSE)),1,IF(ISNA(VLOOKUP("groceries",A3:C103,1,TRUE)),1,IF(ISNA(VLOOKUP("Costco",A3:C103,1,FALSE)),3,2)))

    OR

    =IF(AND(NOT(ISNA(MATCH(A2,walmart!$A$2:$A$102,0))),NOT(ISNA(MATCH(A2,costco!$A$2:$A$102,0)))),2,IF(NOT(ISNA(MATCH(A2,walmart!$A$2:$A$102,0))),1,IF(NOT(ISNA(MATCH(A2,walmart!$A$2:$A$102,0))),,2)))

    In the first case, it works but I can't get 3's to show up, and I need too many words for the formula to work (given that I have so many keywords). I've used to formula with a much greater number of words but given all the words, it won't work.

    In the second case, I can get 1's and 2's, but once more the 3's won't show. It's as if "walmart" will take precedence over "canada", so it'll mark it as a 1. I've tried simply with If and vlookup but this is starting to frustrate me.

    Thanks in advance for any input.

    -B
    Last edited by Bitteeinbit; 10-31-2011 at 04:45 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to get different outputs from sets of keywords

    I'm having trouble determining what a keyword would be that refers to both Walmart and Costco. Would it have both words in it? or neither word?

    Possibly
    =IF(AND(ISNUMBER(SEARCH("COSTCO",A1)),ISNUMBER(SEARCH("Walmart",A1))),3,IF(ISNUMBER(SEARCH("Walmart",A1)),1,IF(ISNUMBER(SEARCH("COSTCO",A1)),2,3)))
    Last edited by ChemistB; 10-31-2011 at 04:50 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    10-29-2011
    Location
    Ldn
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: How to get different outputs from sets of keywords

    I had actually tried a variation of the formula you just gave (though without AND), but the number of keywords made it difficult to do.
    A keyword that refers to both is simply a word that would appear in both categories. So "canada" would be a keyword which appears in both the costo and walmart list. So would many other words such as "groceries", "sale", etc. Problem is: the lists are fairly large and since I took them from the internet searches, some of them are even misspelled (walmaart, costko, etc).

    With the example you provided, where would I put the words I deem to fall in the two categories? Nowhewre right? I would have to find all keywords, then the "3" at the end would cover the rest? But what if it says: "Costo Canada"? We have "costco", so would it go under 1 or 3?

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to get different outputs from sets of keywords

    The way mine is written, if it contains Costco and Walmart, or neither then it's a 3. If it contains Costco, it's a 2 and if it's Walmart only it is a 1. Based on what you are putting it, you'd need three columns of keywords Both, Costco and Walmart. You'd need to have the first if look at the Both column for a match (and assign a 3 if it finds one) then the other two columns. Does that make sense?

+ 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