Saltar al contenido
GridBelt
  • Prueba de Excel
  • Práctica
  • Programas
  • Precios
Iniciar sesión
Empezar la prueba gratuita
  • Prueba de Excel
  • Práctica
  • Programas
  • Precios
Iniciar sesiónCrear cuenta
Empezar la prueba gratuita
GridBelt

Practica Excel en tu navegador.

Prueba de Excel

  • Nivel 1: Principiante
  • Nivel 2: Intermedio
  • Nivel 3: Experto
  • Prueba de Excel en 7 días
  • Clasificación
  • Prueba de Excel para entrevistas
  • Evaluación de Excel de Indeed

Práctica

  • Todos los ejercicios
  • Programas
  • Para principiantes

Guías

  • Fórmulas de Excel
  • Atajos de Excel

Empresa

  • Acerca de
  • Precios
  • Cómo corregimos

© GridBelt. Todos los derechos reservados.

  • Política de privacidad
  • Términos de uso
  • Política de reembolso

Excel es una marca comercial de Microsoft Corporation. Indeed, TestGorilla, SHL y otras marcas son propiedad de sus respectivos titulares. GridBelt es un sitio de práctica independiente y no está afiliado a Microsoft, TestGorilla, SHL ni Indeed, ni respaldado ni patrocinado por ellos.

  1. Práctica
  2. /
  3. XLOOKUP

XLOOKUP with two criteria: price by product and region

  • Experto
  • ~10 min
  • XLOOKUP

Enunciado en inglés

A building-materials supplier prices by region: the Prices sheet holds 60 rows — 15 products × 4 regions — with product, region, unit and unit price. The Quotes sheet has 30 quote lines, each with a product in column C and a region in column D. A lookup on the product alone returns the first region's price and is wrong on 24 of the 30 lines; the key is the pair product + region.

Qué tienes que hacer

  1. 1On Quotes, click F2 and build the two-part key: C2&D2 joins the product and the region into one text.
  2. 2Type =XLOOKUP(C2&D2, then build the matching key for the whole price list: Prices!$A$2:$A$61&Prices!$B$2:$B$61 (select each column on the Prices tab, press F4 / ⌘T, join them with &).
  3. 3Add the return column Prices!$D$2:$D$61, close the bracket and press Enter — Excel 365 evaluates the joined columns as an array, no Ctrl+Shift+Enter needed.
  4. 4Fill F2 down to F31. Alternative without arrays: =SUMIFS(Prices!$D$2:$D$61,Prices!$A$2:$A$61,C2,Prices!$B$2:$B$61,D2) works because every pair appears exactly once.

Celdas de respuesta

Corrección

Escribe tu fórmula en la cuadrícula, presiona Enter y luego haz clic en Comprobar. Evaluamos el valor de cada celda de respuesta y la fórmula que lo produce.

Tareas

  1. Sin comprobarIn F2, return the unit price from the Prices sheet for the product in C2 and the region in D2 — XLOOKUP on the two keys joined with & (or SUMIFS with both criteria) — then fill down to F31.

Para las tareas de hoja de cálculo se recomienda una pantalla grande. La hoja se desplaza dentro de este recuadro.

StartInsertFormulasDataView
A1fxPreparando tu libro…
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

Escribe tu fórmula en la hoja y luego comprueba.

Sobre este ejercicio

Un conjunto de datos de 90 filas en 2 hojas, una celda de respuesta, unos 10 minutos. Se corrige en tu navegador: el valor y la fórmula que lo produce, con comentarios que te dicen qué arreglar.

Cómo resolverlo

  • Quotes!F2=XLOOKUP(C2&D2,Prices!$A$2:$A$61&Prices!$B$2:$B$61,Prices!$D$2:$D$61)

C2&D2 glues the product and the region into one text, and Prices!A2:A61&Prices!B2:B61 does the same for every row of the price list at once, producing a temporary array of 60 combined keys. XLOOKUP then finds the combined key in that array and returns the price from the same row — a two-column match without a helper column. SUMIFS reaches the same number another way: it adds every price whose product and region match, and since each pair appears exactly once, the sum is that single price.

Pitfall 1: joined keys can collide — "AB"&"C" equals "A"&"BC"; insert a separator that never appears in the data (C2&"|"&D2 on both sides) when keys are free text. Pitfall 2: SUMIFS silently sums duplicates and returns 0 for a missing pair, where XLOOKUP returns #N/A; use SUMIFS only when uniqueness is guaranteed and 0 is not a plausible price. Pitfall 3: in Excel 2019 and earlier, the array form needs INDEX/MATCH entered with Ctrl+Shift+Enter: =INDEX(Prices!$D$2:$D$61,MATCH(C2&D2,Prices!$A$2:$A$61&Prices!$B$2:$B$61,0)). Alternatives: boolean algebra =XLOOKUP(1,(Prices!$A$2:$A$61=C2)*(Prices!$B$2:$B$61=D2),Prices!$D$2:$D$61) avoids concatenation; =SUMPRODUCT((Prices!$A$2:$A$61=C2)*(Prices!$B$2:$B$61=D2)*Prices!$D$2:$D$61) is the pre-SUMIFS form; FILTER(…) spills every match, useful when pairs are not unique. Performance: array concatenation evaluates the whole price list for every quote row — fine for thousands of rows, slow for hundreds of thousands, where a helper key column on the Prices sheet is the classic fix.

Otras formas válidas

  • =SUMIFS(Prices!$D$2:$D$61,Prices!$A$2:$A$61,C2,Prices!$B$2:$B$61,D2) — works in every Excel version; relies on each pair being unique
  • =XLOOKUP(1,(Prices!$A$2:$A$61=C2)*(Prices!$B$2:$B$61=D2),Prices!$D$2:$D$61) — boolean array instead of concatenation
  • =INDEX(Prices!$D$2:$D$61,MATCH(C2&D2,Prices!$A$2:$A$61&Prices!$B$2:$B$61,0)) — INDEX/MATCH array form (Ctrl+Shift+Enter before Excel 365)
  • =SUMPRODUCT((Prices!$A$2:$A$61=C2)*(Prices!$B$2:$B$61=D2)*Prices!$D$2:$D$61) — the classic two-criteria formula

Errores frecuentes

Looking up the product only, =XLOOKUP(C2,Prices!$A$2:$A$61,Prices!$D$2:$D$61): it returns the first region listed for that product (North), which is wrong for every quote line in another region — 24 of 30 here.

Cómo corregimos

Se acepta cualquier fórmula que produzca el resultado correcto, salvo que la tarea nombre una función: entonces otra función obtiene media puntuación. Comparamos los valores con una pequeña tolerancia y, en el texto, ignoramos mayúsculas y espacios. Un número correcto escrito a mano en lugar de una fórmula obtiene media puntuación. Las tareas de varias celdas obtienen la puntuación completa con el 100% de las celdas correctas y media puntuación desde el 50%. Cuando importa, también cambiamos una celda de entrada en una copia de tu hoja y comprobamos que tu fórmula se adapta.

Respuestas calculadas con las reglas de Excel 365 y comprobadas en nuestro corrector el 16 de noviembre de 2026. Autor: GridBelt team.

En estos programas

  • Excel test in 7 days, Plan del nivel 3Día 5
  • Excel for Data AnalystsDía 9
  • Excel for Accounting and BookkeepingDía 9

Ejercicios relacionados

  • Replace VLOOKUP with XLOOKUPIntermedio, ~6 min
  • Look left: employee ID by emailExperto, ~6 min
  • Two-way lookup in a matrixExperto, ~8 min
  • Last order date per customerExperto, ~10 min

Referencia de la función

Documentación oficial

Siguiente ejercicio

INDEX and MATCH exact lookup