Sorting string by values is usually used, but have you ever tried to sort strings based on specific word(s)? For instance, sort a list by the number of a word occurrences as below screenshot shown.
Sort by times of “apple” and “banana” appear
![]() |
![]() |
![]() |
If you want to sort a list by a specific word or words, you need to count the number of the words appears first.《》、
1. Select a cell next to the list, type this formula =SUM(–ISNUMBER(SEARCH({“apple”,”banana”}, A1))), apple and banana are the words you need to sort based on, press Enter key and drag fill handle over the cells which need this formula.
2. Keep the formula cells selected, and click Data > Sort A to Z, and check Expand the selection in the Sort Warning dialog.
3. Click Sort, then the list has been sorted by the number of appearance of “apple”and “banana””.