excelstringsearchtextcharacter

Excel: How to extract a certain word, from a list of words, from a range of cells?


I'm looking to extract the varietal type of a wine, from a list of wine names. There's no formatting consistency. I've got a list of 8 potential wine types (shiraz, rosé, chardonnay, etc.) and about 1000 rows of wine names. I'm looking for a search function that can scan a cell for the varietal (from the above list), then in a seperate cell return the matching type.

What I'd like for it to look like

Tried a few =LEFT and =RIGHT functions with character counts but cant get it going.


Solution

  • try this:

    =INDEX(MyVarietals,MATCH(TRUE,ISNUMBER(SEARCH(MyVarietals,C2)),0))
    

    To simplify the formula, I assigned the range name "MyVarietals" to the range F2:F8.

    enter image description here

    If the Varietals contain names that are a partial match, like Cabernet is a partial match for Cabernet Sauvignon, or Blanc is a partial match for Sauvignon Blanc, make sure to order the list of varietals to have the more complex names at the top. This way, the more complex name will be first in the array of True/False returned by the Isnumber function and will be picked by the Match function.