XLOOKUP 와일드카드와 부분 일치

기본 XLOOKUP은 별표를 그냥 문자로 본다. 이 시트에서 SKU-10*를 찾으면 내가 넣은 missing이 나왔다. 다섯 번째 인수 match_mode를 2로 줘야 와일드카드가 되고, 첫 일치인 SKU-101의 가격 12.5가 반환된다. 뒤에 있는 SKU-103이나 SKU-10X가 아니다. Google과 Microsoft의 XLOOKUP 설명은 모두 2를 와일드카드 모드로 둔다.

목차

빠른 답변

기본 XLOOKUP은 별표를 그냥 문자로 본다. 이 시트에서 SKU-10*를 찾으면 내가 넣은 missing이 나왔다. 다섯 번째 인수 match_mode를 2로 줘야 와일드카드가 되고, 첫 일치인 SKU-101의 가격 12.5가 반환된다. 뒤에 있는 SKU-103이나 SKU-10X가 아니다. Google과 Microsoft의 XLOOKUP 설명은 모두 2를 와일드카드 모드로 둔다.

=XLOOKUP("SKU-10*",A2:A6,B2:B6,"missing")

확인 사항

물음표는 한 글자와 일치한다. SKU-10?도 먼저 SKU-101에 걸린다. SKU-110은 SKU-10?에 맞지 않지만 SKU-1*0에는 맞고, 그 검색은 4.1을 반환한다. 못 찾으면 missing이다. 이 인수를 빼면 보통 N/A 오류가 난다. 와일드카드 실패와 섞어 보지 말 것.

주의점 및 호환성

목록에 리터럴 키 A*B-9가 있어 정확 일치에서는 가격 99가 나온다. 와일드카드 모드에서도 A*B-9는 「A, 그다음 임의, 그다음 B-9」에 맞으므로 여기서도 99가 나왔다. 모드 2에서 별표 자체를 찾으려면 Microsoft는 물결표로 이스케이프하라고 하며, 이 파일에서 A~*B-9도 99였다. 소문자 sku-10*도 SKU-101에 걸린다. 와일드카드가 되었다고 대소문자를 구분하지는 않는다.

영어 상세 예제, 수식 및 작성자 메모

I typed this and expected the first SKU that started with SKU-10:

=XLOOKUP("SKU-10*",A2:A6,B2:B6,"missing")

The cell said missing. The list in A2:A6 was SKU-101, SKU-103, SKU-110, A*B-9, and SKU-10X. Nothing in that list is the literal text SKU-10*, and by default XLOOKUP is not doing a wildcard search. The asterisk is just another character.

The fifth argument is match_mode. Google’s XLOOKUP help calls 2 a wildcard match. Microsoft’s XLOOKUP function page says the same, and it spells out that *, ?, and ~ have special meaning in that mode. Once I passed 2, the formula moved:

=XLOOKUP("SKU-10*",A2:A6,B2:B6,"missing",2)    → 12.5
=XLOOKUP("SKU-10?",A2:A6,B2:B6,"missing",2)    → 12.5
=XLOOKUP("SKU-1*0",A2:A6,B2:B6,"missing",2)    → 4.1
=XLOOKUP("ZZ*",A2:A6,B2:B6,"missing",2)        → missing

12.5 is the price on SKU-101, the first row that matches SKU-10*. SKU-103 and SKU-10X also fit that pattern. XLOOKUP does not return all of them, and it does not pick the “best” one. It returns the first hit, which is the same first-match rule I already see in the exact-match XLOOKUP vs INDEX/MATCH vs VLOOKUP write-up.

? is one character. SKU-10? matches SKU-101, SKU-103, and SKU-10X. It does not match SKU-110 (SKU-11 plus a 0). SKU-1*0 is the one that landed on SKU-110 and returned 4.1.

A miss with an if_not_found string stays that string. Drop the "missing" argument and a real miss is #N/A, which is the usual lookup error path.

When the SKU itself contains an asterisk

One of the keys in the test list is the literal text A*B-9, priced at 99. Exact mode finds it, because that is the actual cell value:

=XLOOKUP("A*B-9",A2:A6,B2:B6,"missing")        → 99

Turn wildcard mode on and the same lookup still returns 99. That is not proof of an exact match. In mode 2, A*B-9 means “A, then anything, then B-9,” and A*B-9 happens to fit its own pattern. If another row such as AXB-9 appeared above it, I would expect that earlier row to win. I did not add that row, so I am not going to write down a result I did not see.

To look up the asterisk as a character in mode 2, Microsoft’s page says ~ is the escape. In this file:

=XLOOKUP("A~*B-9",A2:A6,B2:B6,"missing",2)     → 99

That found the literal A*B-9 key. Use the tilde when the stored SKU might contain * or ? and you still need wildcard mode for other searches.

Case is not a wildcard problem

=XLOOKUP("sku-10*",A2:A6,B2:B6,"missing",2)    → 12.5

Lowercase sku-10* still hit SKU-101. Wildcard mode did not become case-sensitive. If the list can hold both SKU-103 and sku-103 with different prices, this is the wrong function; I walked through that mess in Case-Sensitive Lookup.

FIND and SEARCH are a different tool if you are inspecting a single string rather than walking a column. SEARCH already treats * and ? as wildcards; FIND does not. That comparison is in FIND vs SEARCH.

I did not test VLOOKUP with a TRUE / approximate match as a substitute, and I did not test FILTER with a regex. If you need every SKU-10* row, not the first, XLOOKUP is the wrong function anyway.

Oscar

스프레드시트 수식과 오류 해결을 소개합니다. 검증 환경과 미확인 사항은 각 글을 참고하세요.

Google Sheets, 12 Nov 2026, tab XWild. Wildcard behavior also checked against Microsoft’s and Google’s XLOOKUP pages; not re-run in desktop Excel.

다음 글: 조회 및 조건부 합계 XMATCH와 MATCH의 차이