Assign LLC1 and LLC2 to Repeated Identifiers in WPS Spreadsheets
Question details
The user needs an Excel-compatible formula that scans text descriptions for an identifier and assigns LLC1 to the first occurrence, LLC2 to the second occurrence, and optionally continues numbering for later occurrences.

- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A worksheet contains repeated identifiers embedded in longer text descriptions. The user wants to add a label column that distinguishes each occurrence automatically.
- Observed behavior
- Labels need to be assigned in row order without manual scanning, and non-matching rows should remain blank.
Confirm the column that contains the embedded identifier and decide whether you need a two-label cycle or a continuous occurrence number. If your data starts after row 1, adjust the COUNTIF range so the running count starts at the correct first data row.
Use COUNTIF, SEARCH, and MOD to label the first two occurrences as LLC1 and LLC2
Best when you need to automatically mark only the first and second occurrences of a code such as 120672 in a text-based column.
The formula uses SEARCH to test whether the identifier exists in the current description, COUNTIF to count occurrences up to the current row, and MOD to alternate between LLC1 and LLC2.
In WPS Spreadsheets, select the first cell where the label should appear, for example I198 if your descriptions start in H198.
Insert the formula =IF(ISNUMBER(SEARCH("120672",$H198)),IF(MOD(COUNTIF($H$1:$H198,"*120672*"),2)=1,"LLC1","LLC2"),"") and replace 120672 and H with your identifier and description column.
Drag the fill handle downward to copy the formula into the remaining rows. The running COUNTIF range expands for each row automatically.
Check that the first matching row shows LLC1, the next matching row shows LLC2, and non-matching rows remain blank.

Return the occurrence number when you need more than two labels
Use this approach when the identifier can appear three or more times and you want LLC1, LLC2, LLC3, not a repeating two-label cycle.
Assign occurrence labels in WPS Spreadsheets without breaking Excel compatibility
WPS Spreadsheets supports the same COUNTIF, SEARCH, and MOD formulas, so you can open your Excel workbook, enter the labeling formula, and fill it down to automatically mark LLC1, LLC2, or LLC3 occurrences. Your formulas and .xlsx files remain fully compatible with Microsoft Excel.
- 1. Open your workbook in WPS Spreadsheets: Launch WPS Office, click Menu > Open, and select the Excel workbook that contains the repeated identifiers.
- 2. Select the label cell: Click the first cell in the label column next to the first description row.
- 3. Paste the occurrence formula: Enter the formula =IF(ISNUMBER(SEARCH("120672",$H198)),IF(MOD(COUNTIF($H$1:$H198,"*120672*"),2)=1,"LLC1","LLC2"),"") and update the identifier and range to match your data.
- 4. Fill the formula down: Drag the fill handle from the bottom-right corner of the formula cell down through all data rows.
- 5. Check the labels: Verify that matching rows show LLC1, LLC2, LLC3, or your custom labels in the correct order.

Frequently Asked Questions
Can this formula label non-adjacent repeated identifiers?
Yes. The COUNTIF range expands from the first counted row to the current row, so it counts every matching row above regardless of gaps. Non-matching rows simply return empty text.
How do I change the formula to produce LLC3, LLC4, and beyond?
Replace the MOD-based formula with =IF(ISNUMBER(SEARCH("120672",$H198)),"LLC"&COUNTIF($H$1:$H198,"*120672*"),""). This appends the running occurrence number to the LLC prefix.
What should I do if my identifier is part of a longer number or text?
The wildcard search "*120672*" can match 120672 inside longer strings. To avoid matching values such as 1206720, use delimiters around the identifier or create a helper column that extracts the exact code before counting.
Why does my formula return LLC1 again for the third occurrence?
This is expected with the MOD version. MOD(COUNTIF(...),2)=1 alternates between LLC1 and LLC2, so the third occurrence returns LLC1. Use the sequential numbering formula if you need unique occurrence labels.
Can I start counting from a different row instead of row 1?
Yes. Adjust the start of the COUNTIF range, for example $H$2:$H198, and make sure the formula and fill range use the same start row so the running count matches your intended first data row.




