Advanced Excel for Data AnalystsLesson 29 of 49
Lesson 29 of 49

Preset Conditional Formatting Rules & Highlight Logic

Overview & Learning Objectives

What happens when you need to look up an item based on MULTIPLE conditions—like finding the price of a beverage where Item = "Cold Brew", Size = "Large", and Milk = "Oat"? We use Boolean logic matrices `(Col1=X) * (Col2=Y)` inside XLOOKUP.

  • Perform multi-criteria lookups without creating clumsy helper columns.
  • Multiply boolean arrays `(Condition 1) * (Condition 2)` to isolate exact matches.
  • Handle multiple product attributes (Size, Variant, Region) in a single formula.

Industry Standard

Standard: Enterprise financial reconciliation models use multi-criteria XLOOKUP to match invoice records across Vendor ID, Invoice Date, and Amount simultaneously.

Real-World Example: Artisan Coffee Custom Order Search

At Artisan Coffee, a customer orders: Drink: "Latte", Size: "Large", Milk: "Oat Milk". Looking up just "Latte" returns 6 different prices. You need all 3 conditions satisfied to pull the exact ₹240 price.

Drink NameCup SizeMilk OptionPrice (₹)
LatteRegularDairy160
LatteLargeDairy190
LatteLargeOat Milk240
CappuccinoRegularDairy150

Multi-Condition XLOOKUP Syntax

=XLOOKUP(1, (Range1 = Target1) * (Range2 = Target2) * (Range3 = Target3), Return_Range, "Not Found")

Parameters Breakdown

  • 1 (lookup_value): We search for the number 1 (TRUE * TRUE * TRUE = 1).
  • (Range1 = Target1) * ...: Multiplies boolean checks. Only the row that satisfies ALL conditions evaluates to 1.
  • Return_Range: The column containing the values you want (Price column D2:D5).

Sample Walkthrough (Q&A):

Question: Find the price for Drink = "Latte" AND Size = "Large" AND Milk = "Oat Milk".

Formula / Action: `=XLOOKUP(1, (A2:A5="Latte") * (B2:B5="Large") * (C2:C5="Oat Milk"), D2:D5, "N/A")`

Result: ₹ 240

Explanation: Only row 3 satisfies all three criteria (1 * 1 * 1 = 1). Excel pulls the corresponding price.

Common Mistakes & Limitations

  • Forgetting parentheses around each condition `(A2:A5="Latte")`. Without parentheses, Excel miscalculates order of operations.
  • Using `+` instead of `*` when you want AND logic (use `*` for AND; use `+` for OR).

Keyboard Shortcuts

ActionWindowsMac
Evaluate Boolean PortionHighlight portion -> F9Highlight -> F9
Lock Multiple ArraysF4Cmd + T

Pro Tips & Modern Alternatives

  • Use modern `=FILTER(D2:D5, (A2:A5="Latte") * (B2:B5="Large") * (C2:C5="Oat Milk"))` if you expect multiple matching rows.
  • Old-school alternative: create a helper column concatenating values `=A2&B2&C2`.