跳到主要内容

如何在Excel中根据关键字对文本字符串进行分类?

假设我在A列中有一个文本字符串列表,现在,我想基于D列中的关键字对A列中的文本字符串进行分类。例如,对包含Kutools的所有单元格进行分类 Extendoffice,将包含足球,篮球的单元分配给运动,依此类推,如下所示。 我如何在Excel中快速轻松地完成这项复杂的工作?

根据具有数组公式的关键字对文本字符串列表进行分类


办公室标签图片

裁员季节快到了,工作还在吗?
-- Office Tab 加快步伐,节省50%的工作时间!

  •  惊人! 多个文档的操作比单个文档更加轻松和方便。
  •  与其他网络浏览器相比,Office Tab的界面更加强大和美观;
  •  减少数以千计的乏味鼠标单击,告别颈椎病和鼠标手;
  •  被90,000名精英和300多家知名公司选中!
功能齐全,免费试用30天          了解更多             立即下载!
 

根据具有数组公式的关键字对文本字符串列表进行分类

要根据某些关键字对文本字符串进行分类,可以应用以下数组公式:

1。 首先,您应该根据需要对数据进行分类。 例如,我将数据分类为如下所示的屏幕截图:

2。 请输入以下公式或将其复制到空白单元格中:

=INDEX($E$2:$E$8,MATCH(TRUE,ISNUMBER(SEARCH($D$2:$D$8,A2)),0))
  • Tips:在此公式中:
  • $ E $ 2:$ E $ 8:是您要分配给文本字符串的类别;
  • $ D $ 2:$ D $ 8:是您要基于的特定文本;
  • A2:是包含您要分类的文本字符串的单元格。

3。 然后按 Ctrl + Shift + Enter 键在一起,您将得到第一个结果,然后将填充手柄向下拖动到要应用此公式的单元格上,并且所有文本字符串都已根据需要分类为特定组。 看截图:


下载样本文件

点击下载示例文件!


更多相关的文字类别文章:

  • 根据Excel中的值对数据进行分类
  • 假设您需要基于值对数据列表进行分类,例如,如果数据大于90,则将其分类为高;如果数据大于60且小于90,则将其分类为中;如果是,则将其分类为中。小于60,归类为“低”,您如何在Excel中解决此任务?
  • 根据数字范围分配值或类别
  • 本文讨论的是在Excel中分配与指定范围相关的值或类别。 例如,如果给定的数字在0到100之间,则分配值5,如果在101到500之间,则分配10,对于501到1000的范围,则分配15。本文中的方法可以帮助您实现。
  • 在Excel中计算或分配字母等级
  • 根据学生的分数为每个学生分配字母等级可能是教师的一项常见任务。 例如,我定义了一个评分等级,其中分数0-59 = F,60-69 = D,70-79 = C,80-89 = B和90-100 = A,如下图所示。 在Excel中,如何快速,轻松地根据数字分数计算字母等级?
  • 将序列号分配给重复值或唯一值
  • 如果您有一个包含一些重复项的值列表,我们是否可以为重复项或唯一值分配顺序号? 这意味着给重复值或唯一值给出一个顺序。 本文中,我将讨论一些简单的公式来帮助您解决Excel中的这一任务。

  • 超级公式栏 (轻松编辑多行文本和公式); 阅读视图 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 和保存数据; 拆分单元格内容; 合并重复的行和总和/平均值...防止细胞重复; 比较范围...
  • 选择重复或唯一 行; 选择空白行 (所有单元格都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择...
  • 确切的副本 多个单元格,无需更改公式参考; 自动创建参考 到多张纸; 插入项目符号,复选框等...
  • 收藏并快速插入公式,范围,图表和图片; 加密单元 带密码 创建邮件列表 并发送电子邮件...
  • 提取文字,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级筛选 (将过滤方案保存并应用于其他工作表); 高级排序 按月/周/日,频率及更多; 特殊过滤器 用粗体,斜体...
  • 结合工作簿和工作表; 根据关键列合并表; 将数据分割成多个工作表; 批量转换xls,xlsx和PDF...
  • 数据透视表分组依据 周号,周几等 显示未锁定的单元格 用不同的颜色 突出显示具有公式/名称的单元格...
kte选项卡201905
  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
officetab底部
Comments (10)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Thanks for the tips of index how to use, But I have a extend question:
If I wanna sort like "aaaaa" to "row B" & "row C",
gonna be "3a" & "2a" (or"2a" & "3a")
So I use the function "=INDEX(E3:E4,MATCH(TRUE,ISNUMBER(SEARCH(D3:D4,A3)),0))"
(D3 is "aaa", E3 is "3a"; D3 is "aa", D4 is "2a")
The result is "3a" & "3a" in "row B" & "row C"...
Could you make some solutions to this problem? I am so appreciate it.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Is there a way to have a multi word keyword?
Ex: I'm trying to sort out the rows that have "patient ID". However, my keyword "patient id" pulls every row with "patient."
This comment was minimized by the moderator on the site
I have a doubt.I have the data in Sheet 1 ,I want to create the category table in sheet 2 and want the categorized date to be entered in sheet 3. How may i do that
This comment was minimized by the moderator on the site
Hello, Gokul Prakash
Could you give more detailed information of your probelm?
Or you can insert an attachment file or screenshot here to explain your task.
Thank you!
This comment was minimized by the moderator on the site
Doesn't work for me either. I only get "problem with formular". I rebuild your Excel and it also doesn't work there. I don't know if the Problem is "Ctrl + Shift + Enter" i tried everything but nothing works, is there a go around for the key combination?
could you maybe up load your example.

thank you very much
This comment was minimized by the moderator on the site
Hi, Rocket,I have uploaded the attachment file at the end of this article, please download to view.If you have any other problem, please comment here, thank you!
This comment was minimized by the moderator on the site
Doesn't work for me either. I only get "problem with formular". I rebuild your Excel and it also doesn't work there. I don't know if the Problem is "Ctrl + Shift + Enter" i tried everything but nothing works, is there a go around for the key combination?could you maybe up load your example.
hank you very much
This comment was minimized by the moderator on the site
This doesn't work for me. Is it because the keyword may be within the string of text, and not the beginning key word? 
This comment was minimized by the moderator on the site
Hi, Taren,The formula also works well if the keyword is in the middle of the text string, do you remember to press the Ctrl + Shift + Enter keys together after you insert the formula?Please check it, thank you!
This comment was minimized by the moderator on the site
How can you make it such that the match/index references are updated automatically? If I refer to entire column instead of only the cells that contain the values I get a zero as result
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations