Formula Errors

Find the First Comma or Text Pattern in Excel Without a VALUE Error

Elise WilliamsElise Williams Nov 18, 2026 869 views

Question details

Create one Excel formula that finds a comma or the text pattern “ G” when either search string may be missing.

Find the First Comma or Text Pattern in Excel Without a VALUE Error
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.
Before you start

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.

Solution 1Recommended

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.

1
Enter the formula

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).

2
Check the result

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 Earliest Delimiter and Handle Missing Patterns
Position before the delimiter: The result is one less than the delimiter’s position. If the delimiter begins at the first character, the formula returns 0.
Work with formulas in WPS

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. 1. Open your spreadsheet: Open WPS Spreadsheet and use File > Open to select your workbook.
  2. 2. Select a result cell: Click an empty cell such as B2 next to the text in A2.
  3. 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. 4. Apply it to other rows: Drag B2’s fill handle down to calculate positions for the remaining text cells.
Find the earliest delimiter while handling missing patternsOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceWork with a free, lightweight office suite
microsoft office alternative - wps office

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.