Pular para o conteúdo
GridBelt
  • Teste de Excel
  • Prática
  • Programas
  • Preços
Entrar
Começar o teste gratuito
  • Teste de Excel
  • Prática
  • Programas
  • Preços
EntrarCriar conta
Começar o teste gratuito
GridBelt

Pratique Excel no seu navegador.

Teste de Excel

  • Nível 1: Iniciante
  • Nível 2: Intermediário
  • Nível 3: Avançado
  • Teste de Excel em 7 dias
  • Ranking
  • Teste de Excel para entrevista
  • Avaliação de Excel da Indeed

Prática

  • Todos os exercícios
  • Programas
  • Para iniciantes

Guias

  • Fórmulas do Excel
  • Atalhos do Excel

Empresa

  • Sobre nós
  • Preços
  • Como corrigimos

© GridBelt. Todos os direitos reservados.

  • Política de Privacidade
  • Termos de Uso
  • Política de Reembolso

Excel é uma marca comercial da Microsoft Corporation. Indeed, TestGorilla, SHL e outras marcas pertencem aos seus respectivos proprietários. O GridBelt é um site de prática independente e não tem afiliação com Microsoft, TestGorilla, SHL ou Indeed, nem é endossado ou patrocinado por eles.

  1. Prática
  2. /
  3. VLOOKUP

VLOOKUP with IFERROR practice: show "Not found" instead of #N/A

  • Intermediário
  • ~7 min
  • VLOOKUP

Enunciado em inglês

Purchasing exported 100 order lines for printer consumables (November 2026) and needs the current unit price on each line from the Products sheet, a 30-SKU catalogue. 5 lines still reference SKUs that were discontinued and removed from the catalogue, so a plain lookup shows #N/A on those rows and breaks every total built on the column. Pull the price with a lookup, replace the error with the text "Not found", and count how many lines have no price.

O que você precisa fazer

  1. 1On Orders, click E2 and write the lookup first: =VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE) — click the Products tab and select A2:D31 to get the prefix, F4 / ⌘T to lock it.
  2. 2Wrap it: =IFERROR(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found") — IFERROR returns the lookup when it works and the text when it errors.
  3. 3Fill E2 down to E101; the 5 discontinued SKUs now read "Not found" instead of #N/A.
  4. 4Click H2 and count the lines without a price: a COUNTIF over E2:E101 for the text "Not found".

Células de resposta

Correção

Digite sua fórmula na grade, pressione Enter e depois clique em Verificar. Avaliamos o valor de cada célula de resposta e a fórmula por trás dele.

Tarefas

  1. Não verificadoIn E2, look up the unit price of the SKU in C2 on the Products sheet and show "Not found" instead of #N/A when the SKU is missing — IFERROR or IFNA around the lookup (XLOOKUP's if_not_found argument works too) — then fill down to E101.
  2. Não verificadoIn H2, count how many cells in E2:E101 say "Not found".

Recomendamos um computador para as tarefas de planilha. A planilha rola dentro desta caixa.

StartInsertFormulasDataView
A1fxPreparando sua pasta de trabalho…
A
B
C
D
E
F
G
H
I
J
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Sheet1

Digite sua fórmula na planilha e depois verifique.

Sobre este exercício

Um conjunto de dados de 130 linhas em 2 planilhas, 2 células de resposta, cerca de 7 minutos. Corrigido no seu navegador: o valor e a fórmula por trás dele, com feedback que mostra o que corrigir.

Como resolver

  • Orders!E2=IFERROR(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found")
  • Orders!H2=COUNTIF(E2:E101,"Not found")

VLOOKUP with FALSE returns #N/A when the SKU is not in the first column of the table, and any SUM or AVERAGE over a column that contains #N/A becomes #N/A too. IFERROR(value, value_if_error) evaluates the lookup and, only if it produces an error, returns the second argument instead — here the text "Not found" — so the five discontinued lines become readable text and the rest keep their prices. COUNTIF over the finished column counts the text cells: 5 lines need a price decision.

Pitfall 1: IFERROR hides every error, including a #REF! from a broken table reference or a #VALUE! from a typo; IFNA replaces only #N/A, so a genuinely broken formula still shows its error — prefer IFNA when the only expected error is "no match". Pitfall 2: the fallback must be meaningful to whoever consumes the column; "Not found" works for humans, 0 is dangerous because it looks like a free item in totals, and an empty string "" silently disappears from counts. Pitfall 3: in Excel 2003 and earlier IFERROR did not exist, which is why old workbooks use =IF(ISNA(VLOOKUP(...)),"Not found",VLOOKUP(...)) — the lookup runs twice. Alternatives: =IFNA(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found"); =XLOOKUP(C2,Products!$A$2:$A$31,Products!$D$2:$D$31,"Not found") has the fallback built in as its 4th argument (365). Data-quality note: the count in H2 is the real deliverable — the five SKUs need either a replacement product or a clean-up of the order file, and the lookup column is where that gap becomes visible.

Outras formas que funcionam

  • =IFNA(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found") — catches only #N/A, lets other errors through
  • =XLOOKUP(C2,Products!$A$2:$A$31,Products!$D$2:$D$31,"Not found") — Excel 365; the 4th argument is the fallback
  • =IF(ISNA(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE)),"Not found",VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE)) — the pre-2007 pattern
  • =COUNTA(E2:E101)-COUNT(E2:E101) in H2 — text cells = everything minus the numbers

Erros comuns

Putting the fallback inside VLOOKUP, e.g. =VLOOKUP(C2,Products!$A$2:$D$31,4,"Not found"): the 4th argument of VLOOKUP is the match type, not a fallback. The error handler wraps the whole lookup — IFERROR( lookup , "Not found" ).

Como corrigimos

Qualquer fórmula que produza o resultado certo é aceita, a menos que a tarefa cite uma função: nesse caso, outra função vale metade da pontuação. Comparamos os valores com uma pequena tolerância e ignoramos maiúsculas e espaços no texto. Um número certo digitado à mão em vez de uma fórmula vale metade da pontuação. Tarefas com várias células valem a pontuação integral com 100% das células certas e metade a partir de 50%. Quando faz diferença, também mudamos uma célula de entrada em uma cópia da sua planilha e verificamos se sua fórmula acompanha.

Respostas calculadas com as regras do Excel 365 e verificadas no nosso corretor em 16 de novembro de 2026. Autor: GridBelt team.

Nestes programas

  • Excel test in 7 days, Plano do nível 2Dia 3
  • Excel for Administrative AssistantsDia 8
  • Excel for Accounting and BookkeepingDia 6

Exercícios relacionados

  • Pull the unit price with VLOOKUP (exact match)Iniciante, ~5 min
  • Look up a customer tier from another sheetIniciante, ~5 min
  • Replace VLOOKUP with XLOOKUPIntermediário, ~6 min
  • INDEX and MATCH exact lookupIntermediário, ~6 min

Referência da função

Documentação oficial

Próximo exercício

Pick the month column with MATCH