简体   繁体   English

如何从Excel中与值列表匹配的单元格中提取特定单词

[英]How to extract a particular word from a cell in excel that matches a list of values

How to extract a particular word from a cell in excel from a list (array) of possible values and return that matched word. 如何从可能值列表(数组)中从excel的单元格中提取特定单词,然后返回匹配的单词。

I have a list of products, but I just want to know the color. 我有产品清单,但是我只想知道颜色。 The color is embedded in the products description, therefore I need to extract it out of the item description. 颜色嵌入在产品说明中,因此我需要将其从项目说明中提取出来。 Here is a brief example of a list the item descriptions: 这是项目描述列表的简短示例:

CORNER CCP 26" BARN RED
CORNER CCP 28" KHAKI
CORNER CCP 28" SLATE GRAY
CORNER RS EZ ANTIQUE GRAY
CORNER RS EZ 26" ASHWOOD GRAY
CORNER,RSC EZ,AUTUMN CEDAR
CORNER RS EZ 26" BARN RED
CORNER RS EZ 26" CANARY YELLOW
CORNER RS EZ 26" COASTAL BROWN
CORNER,RS EZ 26" COASTAL CLAY
CORNER,RS EZ 26"COASTAL CEDAR
CORNER RS EZ 26" CYPRESS GREEN
CORNER RS EZ 26" CLASSIC WHIT

I want to then compare that Item description with a list of colors I have and then just return those color names. 然后,我想将该商品说明与我拥有的颜色列表进行比较,然后只返回这些颜色名称。

Amaranth
Amber
Amethyst
Apricot
Aquamarine
Azure
Baby blue
Beige
Black
Blue
Blue-green
Blue-violet
Blush
Bronze
Brown
Burgundy
Byzantium
Carmine
Cerise
Cerulean
Champagne
Chartreuse green
Chocolate
Cobalt blue
Coffee
Copper
Coral
Crimson
Cyan
Desert sand
Electric blue
Emerald
Erin
Gold
Gray
Green
Harlequin
Indigo
Ivory
Jade
Jungle green
Lavender
Lemon
Lilac
Lime
Magenta
Magenta rose
Maroon
Mauve
Navy blue
Ocher
Olive
Orange
Orange-red
Orchid
Peach
Pear
Periwinkle
Persian blue
Pink
Plum
Prussian blue
Puce
Purple
Raspberry
Red
Red-violet
Rose
Ruby
Salmon
Sangria
Sapphire
Scarlet
Silver
Slate gray
Spring bud
Spring green
Tan
Taupe
Teal
Turquoise
Violet
Viridian
White
Yankees Blue
Yellow

Place the data in column A. 将数据放在列A中。

Place the list of colors in column B. 将颜色列表放在B列中。

Place the following array formula in column C and fill down: 将以下数组公式放在C列中并填写:

=IFERROR(INDEX($B$1:$B$86,MATCH(1,COUNTIF($A1,"*"&$B$1:$B$86&"*"),0)),"")

Note that this is an array formula. 请注意,这是一个数组公式。 In order for it to operate correctly, first copy and paste from your browser window to Excel, then, with the same cell selected, click in the formula bar (or press F2) and press Control + Shift + Enter. 为了使其正常运行,请先从浏览器窗口复制并粘贴到Excel,然后在选择相同单元格的情况下,在编辑栏中单击(或按F2),然后按Control + Shift + Enter。 There should now be braces around the formula. 现在,公式周围应有括号。

If the string in column A contains more than one of the colors in column B, the first matching column B color will be listed. 如果A列中的字符串包含B列中不止一种颜色,则会列出第一个匹配的B列颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM