Fix REGEXEXTRACT #N/A in Google Sheets (pattern did not match)
Updated
REGEXEXTRACT returns #N/A when the regular expression does not match the text. The formula ran. There was nothing to extract. That is the same error value as a lookup miss. It is not a missing sku and not a FILTER with zero rows.
This page is regex no match. It is not what #N/A means (VLOOKUP / MATCH / FILTER), not VLOOKUP no match (number vs text, or a trailing space), and not FILTER no match.
Recreate it on a blank sheet
Section titled “Recreate it on a blank sheet”- Open a blank spreadsheet. In A1 type
text, B1extract, C1match. - In A2 type
SKU-101. In B2 enter=REGEXEXTRACT(A2,"SKU-(\d+)"). The cell shows101. That row is the control: the pattern matches, the capturing group has digits. - In A3 type
Widget. In B3 enter=REGEXEXTRACT(A3,"SKU-(\d+)"). The cell shows#N/A. There is noSKU-and no digits. The pattern does not match.
REGEXMATCH on the same miss. In C3 enter =REGEXMATCH(A3,"SKU-(\d+)"). The cell shows FALSE. Same text, same pattern. REGEXMATCH does not use #N/A for “no match.” REGEXEXTRACT does.

Capturing nothing. In A4 type SKU- with the hyphen and no digits after it. In B4 enter =REGEXEXTRACT(A4,"SKU-(\d+)"). The cell shows #N/A. You can see the prefix. The capturing group (\d+) still captured nothing, so the whole pattern fails. Same error value as Widget.

Leave B3 and B4 as the broken formulas.
What is actually wrong
Section titled “What is actually wrong”REGEXEXTRACTneeds the pattern to match.Widgetdoes not containSKU-followed by digits. Sheets returns#N/A, not a blank.- A prefix you can see is not enough.
SKU-matches the literal part.(\d+)needs one or more digits. None are there, so the extract is still#N/A. That is capturing nothing — still a failed match, not a blank cell. - Parentheses change what is returned. With
SKU-(\d+), a hit returns only the digits (101), not the wholeSKU-101. If that group cannot match, you get#N/A, not an empty string. REGEXMATCHon the same miss isFALSE. Do not debug C3 as#N/A. If the cell is#N/A, you are looking atREGEXEXTRACT(or a lookup), not aREGEXMATCHno-match.- A pattern that is allowed to capture empty text is a different result.
=REGEXEXTRACT(A4,"SKU-(.*)")returns a blank, because(.*)matches zero characters.(\d+)cannot. Blank vs#N/Ais the quantifier, not a different error family. REGEXREPLACEon a miss returns the original text unchanged. It is not#N/A. This page is extract / match.
This is not a VLOOKUP key miss. Nothing is being looked up. See what #N/A means.
This is not number vs text in a lookup column. See VLOOKUP no match.
This is not FILTER with zero rows or mismatched heights. See FILTER no match.
This is not #VALUE!. A number in the text argument (=REGEXEXTRACT(101,"\d+")) is #VALUE! because regex functions want text. See wrong type. Convert with TEXT if you meant to extract from a numeric cell. B3 is already text.
This is not #REF! from a broken pattern. An invalid regular expression is #REF!, not #N/A. The patterns on this sheet are valid RE2. The text did not match.
Leave B3 and B4 as the broken extracts so #N/A stays on the sheet.
Confirm the miss. In A3 type SKU-101. B3 becomes 101. Put Widget back. If changing the text makes #N/A come and go, the function is working and the pattern does not match that row.
Fix the pattern when the text is right. If A3 is supposed to be a sku code and is Widget, that row has no sku to extract — do not rewrite the regex to silence it. If A4 should have been SKU-101 and someone omitted the digits, type the digits. B4 becomes 101.
When no match is a valid result. Then wrap. In B6 enter =IFNA(REGEXEXTRACT(A3,"SKU-(\d+)"),"none"). The cell shows none. In B7 enter =IFNA(REGEXEXTRACT(A4,"SKU-(\d+)"),"none"). The cell shows none.

Use IFNA, not IFERROR. IFNA catches only #N/A. IFERROR also swallows #VALUE! from a numeric input and #REF! from a broken regex, so those look like “none.” See IFERROR vs IFNA.
Test with REGEXMATCH before you extract. In C6 enter =IF(REGEXMATCH(A3,"SKU-(\d+)"),REGEXEXTRACT(A3,"SKU-(\d+)"),"none"). The cell shows none. FALSE is the miss. You do not wrap REGEXMATCH in IFNA.
Do not wrap a miss you have not confirmed. If A2 is SKU-101 and B2 is #N/A, the pattern is wrong (a missing hyphen, a letter class where you needed digits, an extra ^ that requires the match at the start). Fix the pattern. IFNA will not.