run2_multi-condition-lookups
Implementing two-condition lookups in Excel using INDEX/MATCH with proper sheet references
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 7
01 前言 Front Matter
- name
- run2_multi-condition-lookups
- description
- Implementing two-condition lookups in Excel using INDEX/MATCH with proper sheet references
03 SKILL.md 正文
Multi-Condition Lookups: INDEX/MATCH in Excel
When to Use
Use INDEX/MATCH when you need to:
- Look up data based on TWO OR MORE criteria (e.g., series code AND year)
- Work with data in any row/column order (unlike VLOOKUP/HLOOKUP which require specific ordering)
- Reference cells/ranges from other sheets in the same workbook
Cross-Sheet Reference Syntax
Critical: Use ! for Sheet References (Not .)
Excel and LibreOffice Calc require different syntax for cross-sheet references:
- Excel syntax:
Sheet!CellorSheet!Range - LibreOffice Calc: Also supports
Sheet!Range(Excel compatible) - DO NOT use:
Sheet.CellorSheet.$H$21(these cause #NAME? errors in LibreOffice)
Correct: =INDEX(Data!$H$21:$M$40, MATCH(...), MATCH(...))
Wrong: =INDEX(Data.$H$21:$M$40, MATCH(...), MATCH(...))
Two-Condition INDEX/MATCH Formula
Structure
=INDEX(data_range,
MATCH(row_criteria, row_lookup_range, 0),
MATCH(col_criteria, col_lookup_range, 0)
)
Parameters
- data_range: The 2D range containing the values to return (e.g.,
Data!$H$21:$M$40) - row_criteria: The value to match in rows (e.g.,
$D12for series code) - row_lookup_range: Column containing row criteria (e.g.,
Data!$B$21:$B$40) - col_criteria: The value to match in columns (e.g.,
H$9for year) - col_lookup_range: Row containing column criteria (e.g.,
Data!$H$4:$M$4) - 0: Exact match (required for lookups)
Example: Lookup Exports by Series Code and Year
=INDEX(Data!$H$21:$M$40,
MATCH($D12, Data!$B$21:$B$40, 0),
MATCH(H$9, Data!$H$4:$M$4, 0)
)
Cell Reference Anchoring
Absolute vs. Mixed References
- $column$row: Absolute - never changes when copying
- column$row: Column relative, row absolute - column changes when copying right
- $columnrow: Column absolute, row relative - row changes when copying down
- columnrow: Both relative - both change when copying
Pattern for 2D Data Lookups
=INDEX(Data!$H$21:$M$40, # Absolute data range
MATCH($D12, Data!$B$21:$B$40, 0), # Row criteria absolute, lookup range absolute
MATCH(H$9, Data!$H$4:$M$4, 0) # Column criteria absolute, lookup range absolute
)
When copying:
- Down: Row number in criteria changes ($D12 → $D13)
- Right: Column letter in criteria changes (H$9 → I$9)
Common Errors and Fixes
| Error | Cause | Fix |
|---|---|---|
| #NAME? | Wrong sheet reference syntax (using .) | Change Sheet.Cell to Sheet!Cell |
| #REF! | Invalid range reference | Verify sheet name and ranges exist |
| #N/A | Criteria not found in lookup range | Check criteria value matches exactly |
| #VALUE! | Wrong data type in criteria | Ensure criteria matches lookup data type |
Alternative Functions
- XLOOKUP (Excel 365+): Simpler syntax, more flexible
- VLOOKUP/HLOOKUP: Simpler but requires data in specific order
- LOOKUP: Less flexible but works across both rows and columns
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.