Find the First Comma or Text Pattern in Excel Without a VALUE Error
Question details
Create one Excel formula that finds a comma or the text pattern “ G” when either search string may be missing.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A cell may contain a comma, a space followed by an uppercase G, or neither delimiter.
- Observed behavior
- FIND returns a #VALUE! error when its search string is absent.
Identify the cell containing your text; the examples use A2. The pattern “ G” includes a leading space, and FIND treats uppercase and lowercase letters differently.
Find the Earliest Delimiter and Handle Missing Patterns
Use this formula when the comma or “ G” may appear first, or when both may be absent.
The formula returns the position immediately before the earliest delimiter. It returns a blank if neither delimiter is found.
Select an empty cell such as B2 and enter =IF(AND(ISERROR(FIND(",",A2)),ISERROR(FIND(" G",A2))),"",MIN(IFERROR(FIND(",",A2),LEN(A2)+1),IFERROR(FIND(" G",A2),LEN(A2)+1))-1).
Press Enter. Replace each A2 reference with your source cell if needed, then drag the fill handle down to apply the formula to other rows.

Find the Comma First, Then Fall Back to the Text Pattern
Use this shorter formula when a comma should take priority even if “ G” appears earlier.
Find Delimiters Without Errors in WPS Spreadsheet
Use FIND, IFERROR, and MIN in WPS Spreadsheet to locate the earliest comma or “ G” and return a blank when both are missing.
- 1. Open your spreadsheet: Open WPS Spreadsheet and use File > Open to select your workbook.
- 2. Select a result cell: Click an empty cell such as B2 next to the text in A2.
- 3. Enter the formula: Enter =IF(AND(ISERROR(FIND(",",A2)),ISERROR(FIND(" G",A2))),"",MIN(IFERROR(FIND(",",A2),LEN(A2)+1),IFERROR(FIND(" G",A2),LEN(A2)+1))-1) and press Enter.
- 4. Apply it to other rows: Drag B2’s fill handle down to calculate positions for the remaining text cells.

Frequently Asked Questions
Why does FIND return a #VALUE! error?
FIND returns #VALUE! when the specified text is absent. Wrap FIND in IFERROR to supply another search or a fallback value.
Does the shorter IFERROR formula find whichever delimiter comes first?
No. =IFERROR(FIND(",",A2),FIND(" G",A2))-1 uses the comma whenever one exists. Use the MIN-based formula if you need the earliest of the two patterns.
How can I extract the text before the delimiter?
If B2 contains the position returned by the recommended formula, enter =IF(B2="","",LEFT(A2,B2)) in another cell. It returns a blank when no delimiter is found.
Will FIND match a lowercase g?
No. FIND is case-sensitive, so FIND(" G",A2) matches a space followed by uppercase G. Use SEARCH instead of FIND if you need a case-insensitive match.




