Sub topic 16
Choosing between SUMIFS, XLOOKUP, and INDEX with MATCH
This chapter assumes you know basic Excel formulas, relative and absolute references, financial statement layouts, and the difference between a row and a column. It also assumes that your source data has consistent labels and dates.
Start with the question your formula must answer
Choose the function based on the shape of the task:
- Use
SUMIFSwhen many source rows must be combined into one total. - Use
XLOOKUPwhen one key should return one related value. - Use
INDEXwithMATCHwhen you need a compatible or flexible lookup, especially across two dimensions.
A ledger usually requires aggregation. An assumptions table usually requires retrieval.
Compare the main choices
| Task | Preferred function | Main reason | Main risk |
|---|---|---|---|
| Total expenses by account and month | `SUMIFS` | Applies several filters | Criteria or date boundaries can be wrong |
| Retrieve one assumption by name | `XLOOKUP` | Clear lookup and return ranges | Duplicate keys can return an unexpected first match |
| Retrieve a value by row and column | `INDEX` with `MATCH` | Works across two dimensions | More parts must be maintained |
| Support older Excel versions | `INDEX` with `MATCH` | Broad compatibility | Formula is less readable |
Use SUMIFS for aggregation
SUMIFS is the right choice when the answer is the sum of multiple matching records. The sum range comes first, followed by pairs of criteria ranges and criteria.
=SUMIFS(Data!$F$2:$F$5000,Data!$B$2:$B$5000,$A5,Data!$D$2:$D$5000,">="&C$3,Data!$D$2:$D$5000,"<="&EOMONTH(C$3,0))This formula totals the amount column for one account during one month. It does not retrieve a single source cell. If several ledger rows match, their amounts are added.
Use bounded ranges or Excel Tables instead of entire-column references in large models. Bounded ranges reduce calculation work and make the model's intended data area visible.
Use XLOOKUP for one-dimensional retrieval
XLOOKUP searches one range and returns the corresponding item from another range.
=XLOOKUP($A5,Assumptions!$B$3:$B$12,Assumptions!$C$3:$C$12,"Missing assumption")The fourth argument provides an explicit result when the key is absent. This is safer than allowing an unexplained #N/A error to spread through the model. Test that the key is unique:
=COUNTIF(Assumptions!$B$3:$B$12,$A5)A result other than 1 requires investigation. A zero means the key is missing. A number above one means the table contains duplicates.
> callout note > A lookup function does not validate business meaning. It can return a value successfully even when the key is duplicated, misspelled, or mapped to the wrong period.
Use INDEX with MATCH when compatibility matters
MATCH finds a position, and INDEX returns the value at that position.
=INDEX(Assumptions!$C$3:$C$12,MATCH($A5,Assumptions!$B$3:$B$12,0))The 0 requests an exact match. For a two-way lookup, use one MATCH for the row and another for the column:
=INDEX(Rates!$C$3:$H$12,MATCH($A5,Rates!$B$3:$B$12,0),MATCH(C$4,Rates!$C$2:$H$2,0))This is useful when a rate depends on both an item and a period. XLOOKUP can also perform this task, but nested lookups may be less familiar to users maintaining an older model.
Make the choice deliberately
Prefer the clearest formula that matches the data shape and the workbook's Excel version. For a ledger total, use SUMIFS. For a single assumption, use XLOOKUP when available. Use INDEX with MATCH when backward compatibility or two-dimensional control outweighs brevity.
Exercise
A monthly expense report must total every ledger row matching an account and a month. Which function should you choose, and why?
Show answer
Choose SUMIFS because the result aggregates many matching rows using account and date criteria. Use XLOOKUP or INDEX with MATCH only when retrieving one value from a keyed table.