1 Understanding Lookup Logic and Master Data
A lookup formula searches for a known value, locates the matching record and returns related information from another
field. For example, entering a product code can automatically return its product name, selling price, tax rate and stock category.
This prevents repeated typing and keeps reports connected to one controlled source of truth.
Most professional lookup systems contain two parts: a transaction table, where daily activity is recorded,
and a master table, where stable reference information is maintained. A unique key such as Product ID,
Employee Code, Customer ID or Invoice Number connects the two tables.
Definition: A lookup function searches for a key in a specified range or array and returns a related value from the matching position.
Lookup KeyThe value you already know, such as P104.
Lookup ArrayThe column or row Excel must search.
Return ArrayThe field from which the answer is returned.
Match RuleExact, approximate or wildcard behaviour.
Rules for Dependable Lookup Tables
- Use a unique, non-blank key for each master record.
- Keep codes consistent; numeric 101 and text "101" may not match.
- Remove leading and trailing spaces from imported keys.
- Convert the master range into an Excel Table for automatic expansion.
- Do not merge cells inside the lookup dataset.
- Decide how missing or duplicate keys should be handled before building the formula.
Practical Experiment 1: Audit a Product Master
Create columns for Product ID, Product Name, Category, Selling Price and Tax Rate, then check whether every Product ID is complete and unique.
Step 1: BuildEnter at least 12 sample product records with realistic codes.
Step 2: InspectUse conditional formatting or COUNTIF to identify duplicate codes.
Step 3: CorrectRemove duplicates, blank keys and inconsistent text or number formats.
Learning Output: A clean master table suitable for reliable lookup formulas.
2 VLOOKUP and HLOOKUP: Revision, Use and Limitations
VLOOKUP searches vertically in the first column of a table and returns a value from a specified column number. It remains
common in older workbooks, so advanced learners must understand both its correct use and its risks.
=VLOOKUP(A2, $H$2:$K$20, 3, FALSE)
In this example, Excel searches for the value in A2 within the first column of H2:K20 and returns the value from the third
column of that range. FALSE requests an exact match.
Why VLOOKUP Formulas Can Break
- The lookup column must be the first column of the table array.
- The return field is identified by a hard-coded column number.
- Inserting or deleting columns may return the wrong field.
- Omitting the fourth argument can activate approximate matching unexpectedly.
- It returns the first match and does not warn you about duplicate keys.
Important: For exact business retrieval, always specify FALSE or 0 in VLOOKUP unless an approximate banded lookup is intentionally required.
Practical Experiment 2: Product Price with VLOOKUP
Use a product code entered in A2 to retrieve a product name and price from your Product Master.
Step 1: Retrieve NameBuild an exact-match VLOOKUP for the Product Name field.
Step 2: Retrieve PriceChange the column index to return Selling Price.
Step 3: Test FailureEnter an unknown code and observe the #N/A result.
Learning Output: Understanding of traditional vertical lookup behaviour and limitations.
3 XLOOKUP for Flexible and Professional Retrieval
XLOOKUP separates the search range from the return range. This makes formulas clearer, allows left or right retrieval,
provides a built-in message for missing matches and removes the need to count return-column numbers.
=XLOOKUP(A2, ProductMaster[Product ID], ProductMaster[Selling Price], "Code Not Found")
Professional Advantages of XLOOKUP
Left Lookup
Built-in Missing Message
No Column Counting
Can Return Multiple Columns
=XLOOKUP(A2, ProductMaster[Product ID], ProductMaster[[Product Name]:[Selling Price]], "Not Found")
In supported Excel versions, the second formula can spill several related fields into adjacent cells from one lookup.
Practical Experiment 3: Upgrade VLOOKUP to XLOOKUP
Replace the VLOOKUP formulas from Experiment 2 with structured XLOOKUP formulas.
Step 1: ConvertUse Product ID as the lookup array and Product Name as the return array.
Step 2: Add ControlDisplay “Invalid Product Code” when no match exists.
Step 3: CompareInsert a new master-table column and confirm that XLOOKUP still returns the correct field.
Learning Output: A more readable and resilient lookup formula.
4 XMATCH for Finding a Position
XMATCH returns the relative position of a value within a one-dimensional range. It does not return the related business
value directly; instead, it tells Excel where the match appears. This position can be used independently or supplied to INDEX.
=XMATCH(A2, ProductMaster[Product ID], 0)
If the entered product code is the fifth item in the Product ID column, XMATCH returns 5.
Where XMATCH Is Useful
- Checking whether a code exists in a list.
- Locating a selected month or heading for a two-way lookup.
- Finding the first or last occurrence of a value.
- Replacing older MATCH formulas with clearer match and search modes.
=XMATCH(A2, Sales[Customer ID], 0, -1) // search from last record to first
Practical Experiment 4: Find First and Last Transactions
Use a Customer ID that appears several times in a sales list.
Step 1: First MatchUse search mode 1 to return the first matching position.
Step 2: Last MatchUse search mode -1 to return the final matching position.
Step 3: ExplainWrite when the first or latest transaction is more useful.
Learning Output: Control over match position and search direction.
5 INDEX and MATCH: A Flexible Classic Combination
INDEX returns a value from a given row or column position. MATCH identifies the position of the lookup key. When combined,
MATCH finds the row and INDEX returns the corresponding value from any selected return column.
=INDEX(ProductMaster[Selling Price], MATCH(A2, ProductMaster[Product ID], 0))
1Identify the Key
Choose the Product ID or other known value.
2MATCH the Position
Find the row number within the lookup column.
3INDEX the Answer
Return the value from the same position in another column.
4Handle Missing Keys
Add IFNA or a controlled validation process.
Professional Tip: INDEX with MATCH remains valuable for compatibility with Excel versions that do not support XLOOKUP and for advanced two-dimensional models.
Practical Experiment 5: Employee Department Lookup
Use Employee Code to return Department from an Employee Master table.
Step 1: MATCHTest MATCH separately and confirm the returned row position.
Step 2: INDEXEmbed MATCH inside INDEX to return Department.
Step 3: Return LeftPlace Employee Name left of Employee Code and confirm the formula can still return it.
Learning Output: A flexible lookup that is independent of column direction.
6 Two-Way Lookup Using Row and Column Selection
A two-way lookup retrieves a value at the intersection of one selected row and one selected column. For example, you may
choose a salesperson in one cell and a month in another cell, then return the sales amount where that person and month meet.
=INDEX(B2:M10, XMATCH(P2, A2:A10), XMATCH(P3, B1:M1))
Practical Experiment 6: Monthly Performance Matrix
Create a matrix containing six employees and six months of performance values.
Step 1: Select RowCreate a dropdown for Employee Name.
Step 2: Select ColumnCreate a dropdown for Month.
Step 3: RetrieveUse INDEX with two XMATCH functions to return the selected value.
Learning Output: An interactive two-dimensional performance lookup.
7 Multiple-Condition Lookups
A single field may not uniquely identify a record. A price list could contain the same Product ID for several branches,
or an employee could have one attendance record for every month. In such cases, two or more conditions must be matched together.
=XLOOKUP(1, (Sales[Product ID]=H2)*(Sales[Branch]=H3), Sales[Net Amount], "Not Found")
Each comparison creates TRUE or FALSE values. Multiplication converts TRUE to 1 and requires both conditions to be TRUE,
producing a combined lookup value of 1 only for the qualifying record.
Alternative Helper-Key Method
=[@[Product ID]]&"|"&[@Branch]
=XLOOKUP(H2&"|"&H3, Sales[Helper Key], Sales[Net Amount], "Not Found")
A helper key is easier for beginners to audit, while array-based criteria keep the table cleaner. Choose based on maintainability and workbook compatibility.
Practical Experiment 7: Branch-Wise Product Price
Build a price table where one Product ID has different selling prices in different branches.
Step 1: Create DataEnter Product ID, Branch and Price for at least 15 rows.
Step 2: Match Two InputsRetrieve price using the selected Product ID and Branch.
Step 3: Test DuplicatesCheck whether the combination is truly unique before trusting the result.
Learning Output: Accurate retrieval from datasets that require more than one key.
8 Exact, Approximate, Wildcard and Search Modes
Lookup accuracy depends on the selected match rule. Exact matching is safest for IDs and codes. Approximate matching is useful
for rate slabs, grading bands, commission percentages and tax tables. Wildcards help when only part of the text is known.
=XLOOKUP(F2, Commission[Minimum Sales], Commission[Rate], "Below Minimum", -1)
Risk Control: Approximate lookups can produce believable but incorrect answers when threshold data is incomplete, unsorted where required, or logically designed in the wrong direction.
Practical Experiment 8: Commission Slab Lookup
Create a commission table with minimum sales thresholds and corresponding rates.
Step 1: Define SlabsCreate ascending thresholds such as 0, 25,000, 50,000 and 100,000.
Step 2: Retrieve RateUse an approximate XLOOKUP to return the applicable commission percentage.
Step 3: Boundary TestTest values below, exactly at and just above every threshold.
Learning Output: A validated slab-based retrieval system.