Sub topic 6
Matching Text and Numbers Exactly
This chapter assumes you can enter and copy formulas, use SUM, COUNT, and AVERAGE, and read the sales layout from earlier chapters. Here you will learn how a plain criterion is matched against cells, and which mistakes cause wrong totals.
How an exact-match criterion works
A criterion with no operator is an equality test. Excel compares each cell in the criteria range to the value you wrote and keeps the row only if they are equal.
=SUMIFS(D2:D100, B2:B100, "West")This adds Amount for every row where Region is West. Three rules shape the result:
- Text matching ignores letter case. "west", "West", and "WEST" all match.
- The whole cell must match. "West" does not match "West Coast" or "Northwest". Partial matches need wildcards, which a later chapter covers.
- Text criteria go inside double quotes. Numbers do not need quotes.
Matching numbers
A number criterion works the same way. Suppose column D holds Amount and you want to count rows that equal exactly 300.
=COUNTIFS(D2:D100, 300)Writing "300" also works, because Excel reads the quoted text as a number when it compares. The result is the same in both forms.
Diagram: how a row is tested
Common errors with exact matches
Most wrong results come from the data, not the formula. Check these first:
| Symptom | Likely cause | Fix |
|---|---|---|
| Total is 0 for a region you can see | Extra space, such as "West " | Clean the data with TRIM or retype the cell |
| Some rows are missed | Spelling differs, such as "Wset" | Standardize the values |
| Count is lower than expected | Numbers stored as text in one column | Convert them to real numbers |
| Result is correct for "West" but wrong for "West Coast" | Whole-cell matching | Use a wildcard, or list each value |
A trailing space is the hardest to notice. The cell looks like "West" but is actually "West ", so it does not equal the criterion. A quick check is =LEN(B2). If it returns 5 for "West", a space is hiding in the cell.
Worked example
Using the sample sales data, two rows have Region "West": the laptop sale of 1200 and the monitor sale of 310.
=SUMIFS(D2:D100, B2:B100, "West")Excel tests rows 2 to 100 in column B. Rows 2 and 4 match, so it adds 1200 and 310 and returns 1510.
To be more specific, add a second pair for Product.
=SUMIFS(D2:D100, B2:B100, "West", C2:C100, "Monitor")Now only row 4 satisfies both tests, so the result is 310.
Exercise
A cell in column B shows "East" but =COUNTIFS(B2:B100, "East") skips it. Name one likely cause and one way to check it.
Show answer
The cell probably contains a hidden space, such as "East ", so it does not equal "East". Check it with =LEN(B2), which returns 5 instead of 4. Fix it by retyping the value or cleaning it with TRIM.