Find the Position of a Word in a Comma-Separated Excel Cell
Question details
Determine whether a target word is first, second, third, or later in a comma-separated list in an Excel cell.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A cell contains a comma-separated list, and target words are listed in column headers.
- Observed behavior
- The desired result is the target word's list position, or a blank if it is not found.
Make sure the list uses commas as separators and each target word is in a separate header cell. The example below uses Q52 for the list and R51 for the target word.
Count the Commas Before the Target Word in Excel
Use a formula to return the target's position in the list and leave the result blank when it is not found.
SEARCH locates the target text, and the formula counts the commas before it. Adding 1 converts that count into a list position.
Enter a comma-separated list in Q52 and a nonempty target word in R51.
Select R52 and enter =IFERROR(LEN(LEFT($Q52,SEARCH(R$51,$Q52)-1))-LEN(SUBSTITUTE(LEFT($Q52,SEARCH(R$51,$Q52)-1),",",""))+1,"").
Drag the fill handle from R52 down for additional lists and right for additional target headers. The result is 1 for the first item, 2 for the second, and so on.
Find a Word's List Position in WPS Spreadsheets
Use the same comma-counting formula in WPS Spreadsheets to find a target word's position in a cell.
- 1. Open your spreadsheet: Open WPS Spreadsheets and select the workbook containing your comma-separated lists.
- 2. Set up the cells: Place a list in Q52 and a nonempty target word in R51, or adjust the cell references in the formula to match your sheet.
- 3. Enter the formula: Select R52 and enter =IFERROR(LEN(LEFT($Q52,SEARCH(R$51,$Q52)-1))-LEN(SUBSTITUTE(LEFT($Q52,SEARCH(R$51,$Q52)-1),",",""))+1,"").
- 4. Fill other cells: Drag the fill handle down and right to calculate positions for additional lists and target words.

Frequently Asked Questions
What happens if the word is not in the cell?
SEARCH returns an error when it cannot find the target, and IFERROR makes the result cell appear blank.
Does the formula find whole words only?
No. SEARCH can match text inside a longer word. For example, searching for "pear" can match "pearl".
Does capitalization affect the result?
No. SEARCH is not case-sensitive, so it treats uppercase and lowercase letters as matches.
Can Excel calculate character positions automatically?
Yes. Enter =SEARCH(R51,Q52) to return the character position where the target begins. That character position is different from the comma-separated list position returned by the main formula.
Why does the formula use dollar signs in the cell references?
$Q52 keeps the list in column Q when copied across, while R$51 keeps the target in row 51 when copied down. The other parts of those references change as you fill the formula.




