Courses Learn Blog Contact
Get Started →
Lesson 17

Week 4, Virtual 1: Lookup Practice and Data Validation

Two XLOOKUPs into the Staff Directory, then a dropdown that stops anyone typing a category that does not exist.

Webbo3 Data Analytics Cohort 2: Excel Track 9 min read Free

Webbo3 Data Analytics · Cohort 2 · Excel Track · Week 4, Virtual 1

Lookup Practice and Data Validation

Two lookups into the Staff Directory on your own, then the other side of clean data: stopping bad values from being typed in the first place.

By the end of this class you can

  • Fetch a zone and a manager from the Staff Directory with XLOOKUP
  • Check a lookup against a column you built another way
  • Explain why a lookup table is easier to maintain than a long IFS
  • Build a dropdown list with Data Validation, from typed items or from a range
  • Combine a dropdown and XLOOKUP into a small order form

Weeks 2 and 3 cleaned up mistakes after they happened. Data Validation is how you stop them happening. Every " chidi okonkwo" you fixed with PROPER and TRIM was typed by a person into a cell that would have accepted anything.

What you do in this class

  1. Part 1: look up each sale's zone and manager from the Staff Directory, and check them.
  2. Part 2: build a dropdown for Category on a new sheet and try to break it.
  3. Part 3: build the small order form.

Hand in: Sales Data with a working manager lookup, and an Order Form sheet with validated cells.

Part 1: Two Lookups Into the Staff Directory

Every sale carries a Staff_ID (column H). The Staff Directory tab has one row per Staff_ID, with the branch, region, zone, manager and contract of that person.

What we are looking atWe want to see the Staff Directory tab: the lookup table for everything about a salesperson.
XTechPlug_Sales_Workbook.xlsx - Excel
The Staff Directory tab
ABCDEFG
1Staff_IDStaff_NameBranchRegionZoneManagerEmployment_Type
2EMP-001Chidi OkonkwoLagos IslandLagosSouth WestAmaka EzeFull Time
3EMP-002Ngozi AdeyemiLagos MainlandLagosSouth WestAmaka EzeFull Time
4EMP-003Tunde BelloIbadanOyoSouth WestAmaka EzeFull Time
5EMP-004Aisha MusaKanoKanoNorth WestIbrahim SuleContract
6EMP-005Yusuf AbdullahiKadunaKadunaNorth WestIbrahim SuleFull Time
7EMP-006Emeka NwosuEnuguEnuguSouth EastChioma ObiFull Time
8EMP-007Fatima GarbaAbujaFCTNorth CentralIbrahim SuleFull Time
9EMP-008Seun OlatunjiPort HarcourtRiversSouth SouthChioma ObiFull Time
10EMP-009Blessing OkoroWarriDeltaSouth SouthChioma ObiContract
11EMP-010Musa DanladiJosPlateauNorth CentralIbrahim SuleFull Time
Cleaning ProcessSales DataProduct CatalogueStaff Directory

Lookup 1: Zone

What this formula doesWe want each sale's zone fetched from the Staff Directory by its Staff_ID.
XTechPlug_Sales_Workbook.xlsx - Excel
After Enter and Fill Down
P2
fx
=XLOOKUP(H2,'Staff Directory'!$A$2:$A$11,'Staff Directory'!$E$2:$E$11)
A⋯H⋯J⋯OP
1Transaction_IDStaff_IDBranchZoneZone_Lookup
2TP-0892EMP-004KanoNorth WestNorth West
3TP-0785EMP-007AbujaNorth CentralNorth Central
4TP-0210EMP-007AbujaNorth CentralNorth Central
5TP-0343EMP-004KanoNorth WestNorth West
⋮⋮⋮⋮⋮⋮
9TP-0962EMP-009WarriSouth SouthSouth South
⋮⋮⋮⋮⋮⋮
12TP-0442EMP-003IbadanSouth WestSouth West
⋮⋮⋮⋮⋮⋮
22TP-0511EMP-008Port HarcourtSouth SouthSouth South
Filled down from P2 to P1051: 1,050 rows. Rows 2, 3, 4, 5, 9, 12, 22 shown.
Cleaning ProcessSales DataProduct CatalogueStaff Directory

Zone_Lookup agrees with the Zone column you built with IFS in Week 3, on every row. Check it yourself: in Q2 type =P2=O2, fill it down, and filter for FALSE. There are none. Same answer, very different formula. Delete the check column afterwards.

Lookup 2: Manager

What this formula doesWe want the manager responsible for each sale, fetched from the Staff Directory.
XTechPlug_Sales_Workbook.xlsx - Excel
After Enter and Fill Down
P2
fx
=XLOOKUP(H2,'Staff Directory'!$A$2:$A$11,'Staff Directory'!$F$2:$F$11)
A⋯HI⋯P
1Transaction_IDStaff_IDStaff_NameManager
2TP-0892EMP-004Aisha MusaIbrahim Sule
3TP-0785EMP-007Fatima GarbaIbrahim Sule
4TP-0210EMP-007Fatima GarbaIbrahim Sule
5TP-0343EMP-004Aisha MusaIbrahim Sule
⋮⋮⋮⋮⋮
9TP-0962EMP-009Blessing OkoroChioma Obi
⋮⋮⋮⋮⋮
12TP-0442EMP-003Tunde BelloAmaka Eze
⋮⋮⋮⋮⋮
22TP-0511EMP-008Seun OlatunjiChioma Obi
Filled down from P2 to P1051: 1,050 rows. Rows 2, 3, 4, 5, 9, 12, 22 shown.
Cleaning ProcessSales DataProduct CatalogueStaff Directory

Every sale now carries its manager: Amaka Eze, Chioma Obi or Ibrahim Sule. Not one name was typed, so not one can be misspelt. With this column, a SUMIFS can tell each manager what their team sold.

Why the Lookup Table Wins

What this formula doesWe want the zone of a sale by a new member of staff in a new Owerri branch, after one row for them is added to the Staff Directory and the lookup range is extended to row 12.
XBook1 - Excel
After Enter and Fill Down
C2
fx
=XLOOKUP(A2,'Staff Directory'!$A$2:$A$12,'Staff Directory'!$E$2:$E$12)
ABC
1Staff_IDBranchZone
2EMP-001Lagos IslandSouth West
3EMP-011OwerriSouth East
4EMP-004KanoNorth West
Filled down from C2 to C4: 3 rows. Rows 2, 3, 4 shown.
Sheet1Staff Directory

The Week 3 IFS returns #N/A for Owerri, because nobody wrote an Owerri test into the formula, and it would need editing in every report that uses it. With a lookup table, opening a branch means adding one row to the Staff Directory. Business rules belong in tables, where anyone can see and change them, not buried inside formulas.

A Tip for Tables That Grow

Instead of 'Staff Directory'!$A$2:$A$11, you can point at whole columns, 'Staff Directory'!A:A and 'Staff Directory'!E:E. New rows are then included automatically. It is slightly slower on very large sheets, which does not matter at this size.

Picture This

Picture a phone contact list versus a note glued inside the phone case. Adding a friend to the list takes a second. Changing the glued note means taking the phone apart.

Part 2: Data Validation

Definition

Data Validation is a rule attached to a cell that controls what can be typed into it: only items from a list, only whole numbers in a range, only dates after a certain day. Anything else is refused with a message.

Real-Life Scenario

A bank deposit form with boxes for each digit of your account number, and a list of branches to tick instead of a blank line to write on. The form is designed so that you cannot easily fill it in wrongly. Data Validation designs your spreadsheet the same way.

Types of Validation

AllowUse it forTechPlug example
ListA fixed set of choices, shown as a dropdownCategory: Accessories, Appliances, Laptops, Smartphones, Televisions
Whole numberCounts, with a minimum and maximumQuantity between 1 and 10
DecimalAmounts with fractionsA discount between 0 and 0.3
DateDates within a rangeA sale date in 2024
Text lengthCodes of a fixed lengthA Product_ID of exactly 7 characters

Type 1: A Dropdown List

Add a new sheet called Order Form. Type Category in A1 and select B1.

Category dropdown

1.Select B1 › Data › Data Validation
2.Settings tab › Allow: List › Source: Accessories,Appliances,Laptops,Smartphones,Televisions › Tick In-cell dropdown › OK
What we are looking atWe want to see the dropdown open on B1: only the five categories can be chosen.
XTechPlug_Sales_Workbook.xlsx - Excel
Order Form, B1 selected

Now try to break it. Click B1 and type laptops with a space after it, then press Enter.

What Excel tells youWe want to see what Excel does when someone types a value that is not in the list.
Microsoft Excel
×This value doesn't match the data validation restrictions defined for this cell.
RetryCancelHelp

Refused. The kind of value that made Week 2 necessary cannot get into this cell. (Capitals are the one thing a list ignores: typing LAPTOPS is accepted, because Excel compares list items without caring about case.)

Type 2: A Whole Number Rule, With Your Own Message

Quantity rule

1.Type Quantity in A2 › Select B2 › Data › Data Validation
2.Settings tab › Allow: Whole number › Data: between › Minimum: 1 › Maximum: 10
3.Input Message tab › Title: Quantity › Input message: Units sold, from 1 to 10
4.Error Alert tab › Style: Stop › Title: Check the quantity › Error message: Quantity must be a whole number from 1 to 10 › OK
What Excel tells youWe want to see the custom error when someone types 2.5 into the Quantity cell.
Check the quantity
×Quantity must be a whole number from 1 to 10
RetryCancelHelp

Why 1 to 10? Because no sale in the Sales Data sheet is for more than 10 units: a rule based on what the business really does. The Input Message appears as a small yellow note whenever someone selects B2, before they type anything: prevention, not just refusal. The three error styles behave differently: Stop refuses the value, Warning asks "Continue?", and Information just tells you and accepts it.

Validation Only Checks What Is Typed

Data Validation does not check values pasted into a cell, or values that were there before the rule was added. For existing data, use Data > Data Validation arrow > Circle Invalid Data, which draws a red circle round every cell that breaks the rule.

Part 3: Overall Example, a Small Order Form

Put it together. The dropdown for the product reads its list from the Product Catalogue, so it is always up to date, and XLOOKUP fills in the name and the price.

Order form

1.Order Form: A3 Product_ID, A4 Product, A5 Unit price, A6 Total
2.Select B3 › Data › Data Validation › Allow: List › Source: ='Product Catalogue'!$A$2:$A$21 › OK
3.B4: =XLOOKUP(B3,'Product Catalogue'!$A$2:$A$21,'Product Catalogue'!$B$2:$B$21,"Choose a product")
4.B5: =XLOOKUP(B3,'Product Catalogue'!$A$2:$A$21,'Product Catalogue'!$E$2:$E$21,"")
5.B6: =IF(ISNUMBER(B5),B2*B5,"")
What we are looking atWe want to see the form after choosing Laptops, typing a quantity of 3 and choosing PRD-005 from the product dropdown.
XTechPlug_Sales_Workbook.xlsx - Excel
Order Form
B6
fx
=IF(ISNUMBER(B5),B2*B5,"")
AB
1CategoryLaptops
2Quantity3
3Product_IDPRD-005
4ProductHP Laptop 15
5Unit price450,000
6Total1,350,000
Order FormCleaning ProcessSales DataProduct CatalogueStaff Directory

Three HP Laptop 15s at N450,000 each: N1,350,000. Nobody typed a name or a price, and nobody can choose a product that does not exist. If procurement changes the price on the Product Catalogue tab, the form updates immediately. This is a tiny version of how real order systems are built.

Try This

Add the Quantity rule from Part 2 to B2, then try typing 0, 15 and 2.5. Which ones are refused?

Check your answer

All three. 0 and 15 are outside the range; 2.5 is not a whole number.

Picture This

Picture the bank form again, with boxes, tick-lists and a clerk who fills in the charges for you. The customer can only make choices that make sense, and the arithmetic is never theirs to get wrong.

Checkpoint

Q1. Why is a Staff Directory lookup better than the Week 3 IFS for zones?

A new branch is one new row in the directory. With IFS, every formula that uses the rule must be edited.

Q2. A dropdown list refuses "laptops " with a space. Does it refuse "LAPTOPS"?

No. List validation ignores capitals, but not spaces.

Q3. Does Data Validation check values that are pasted in?

No. Use Circle Invalid Data to find invalid values already in the sheet.

Q4. What is the difference between the Stop and Warning error styles?

Stop refuses the value. Warning lets the person continue after a warning.

Tick Before You Move On

  • ☐ My zone lookup matches the Week 3 Zone column on every row
  • ☐ Every sale has its manager, looked up from the Staff Directory
  • ☐ I built a dropdown, tried to break it, and saw the error
  • ☐ I set a custom input message and error alert
  • ☐ My order form fills in the product, the price and the total by itself

Quick Recap

XLOOKUP against a lookup table replaces long IFS rules and is easier to keep up to date. Data Validation controls what can be typed: lists, numbers, dates and text lengths. An input message prevents mistakes; an error alert refuses them. Validation does not check pasted or existing values; Circle Invalid Data does. A dropdown plus a lookup makes a form where wrong entries are hard to make.

Next, Week 4, Live 2: PivotTables. A thousand sales summarised by zone in four drags, a chart that updates with it, a slicer to filter it, and a first look at Power Query.

Learn this with a real instructor

Free lessons take you a long way on your own. The full programmes add live classes, assignments, Skill Points and a certificate — built for African students.