Skip to main content

How to categorize text strings based on keywords in Excel?

Supposing, I have a list of text strings in Column A, now, I want to categorize the text strings in Column A based on the keyword in Column D. For example, to categorize all cells which contain Kutools to Extendoffice, assign the cells contain football, basketball to Sport, and so on as following screenshot shown. How could I finish this complicated job quickly and easily in Excel?

Categorize list of text strings based on keywords with array formula


office tab pic

Layoff season is coming, still work slowly?
-- Office Tab boosts your pace, saves 50% work time!

  •  Amazing! The operation of multiple documents is even more relaxing and convenient than single document;
  •  Compared with other web browsers, the interface of Office Tab is more powerful and aesthetic;
  •  Reduce thousands of tedious mouse clicks, say goodbye to cervical spondylosis and mouse hand;
  •  Be chosen by 90,000 elites and 300+ well-known companies!
Full feature, Free Trial 30-day          Read More             Download Now!
 

Categorize list of text strings based on keywords with array formula

To categorize the text strings based on some keywords, you can apply the below array formula:

1. First, you should categorize the data as you need. For example, I will categorize the data as below screenshot shown:

2. Please enter or copy the following formula into a blank cell:

=INDEX($E$2:$E$8,MATCH(TRUE,ISNUMBER(SEARCH($D$2:$D$8,A2)),0))
  • Tips: In this formula:
  • $E$2:$E$8: is the category that you want to assign to the text strings;
  • $D$2:$D$8: is the specific text you want to categorize based on;
  • A2: is the cell contains the text string that you want to be categorized.

3. And then press Ctrl + Shift + Enter keys together, and you will get the first result, then, drag the fill handle down to the cells that you want to apply this formula, and all text strings have been categorized as the specific group as you need. See screenshot:


Download sample file

Click to download the sample file!


More relative text category articles:

  • Categorize Data Based On Values In Excel
  • Supposing, you need to categorize a list of data based on values, such as, if data is greater than 90, it will be categorized as High, if is greater than 60 and less than 90, it will be categorized as Medium, if is less than 60, categorized as Low, how could you solve this task in Excel?
  • Assign A Value Or Category Based On A Number Range
  • This article is talking about assigning value or category related to a specified range in Excel. For example, if the given number is between 0 and 100, then assign value 5, if between 101 and 500, assign 10, and for range 501 to 1000, assign 15. Method in this article can help you get through it.
  • Calculate Or Assign Letter Grade In Excel
  • To assign letter grade for each student based on their scores may be a common task for a teacher. For example, I have a grading scale defined where the score 0-59 = F, 60-69 = D, 70-79 = C, 80-89 = B, and 90-100 = A as following screenshot shown. In Excel, how could you calculate letter grade based on the numeric score quickly and easily?
  • Assign Serial Number To Duplicate Or Unique Values
  • If you have a list of values which contains some duplicates, is it possible for us to assign sequential number to the duplicate or unique values? It means giving a sequential order for the duplicate values or unique values. This article, I will talk about some simple formulas to help you solving this task in Excel.

  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns and Keeping Data; Split Cells Content; Combine Duplicate Rows and Sum/Average... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Favorite and Quickly Insert Formulas, Ranges, Charts and Pictures; Encrypt Cells with password; Create Mailing List and send emails...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • Pivot Table Grouping by week number, day of week and more... Show Unlocked, Locked Cells by different colors; Highlight Cells That Have Formula/Name...
kte tab 201905
  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
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