5.5 Inconsistent City Spellings
1. Use a confirmed place map, not a guessed spelling
A student intern combines the campus union's receipts after people order parcels and groceries through retailers such as Amazon and Blinkit. One spreadsheet uses Pune, another types PUNE and one export uses Nasik. Grouping the raw input gives city totals that look split. Fixing ordinary case and spaces helps the direct matches. A spelling such as Nasik needs a confirmed mapping to Nashik in the union's own practice report.
Some words cannot be resolved without more information. A value of Aurangabad in a Maharashtra record and a value of Aurangabad in a Bihar record can point to different places. For the Maharashtra practice row, a confirmed legacy source lookup tells the union to use Chhatrapati Sambhajinagar as its current reporting label. The Bihar source uses Aurangabad. A third raw record with no state remains open. These are fictional orders and amounts, using approved practice assumptions rather than claiming how any company tracks addresses.
The official district portals illustrate the importance of jurisdiction. Maharashtra's portal identifies its district as Chhatrapati Sambhajinagar, while Bihar maintains a distinct Aurangabad district portal. Read the source's geographic level before treating a district label, city, locality or service region as interchangeable. Maharashtra district portal and Bihar district portal.
Normalise characters, then resolve meaning. Use a reviewed mapping table with enough context. Keep an unknown or ambiguous input visible until somebody can confirm it.
Keep a city and an area in separate fields
A customer note may say Near Pune station. An area might be named Pune Camp or Pune Cantonment in a source that uses distinct geographical levels. A report for city totals should have an explicit input or approved mapping for the city. Replacing every occurrence of Pune in longer text could damage those details. Keep the address, service area and reported city in their own columns. Use a stable place identifier if the receiving report can recognise it.
Ask what to do with historical labels too. Some reports show the recorded name at the time of the order, while another uses a current standard for grouping. Those goals can use the same preserved raw name and different report fields. Agree on the reporting date, applicable level and exact label, then test a known historical variation. A worksheet cannot decide an official rename from spelling similarity.
2. Turn an approved source into a reliable lookup
Make the reference table inspectable
- State or jurisdiction. Use a stable input that provides relevant context. The fixture uses MH and BR as workbook labels for the two states. Check their source meanings rather than relying on arbitrary abbreviations in a real file.
- Normalised alias. Agree on the uppercase form and which edge spaces to trim. This represents a possible incoming label, not an invented place.
- Canonical report label. Store the approved human-readable name, including its verified spelling. The map may point several aliases to the same label.
- Approval or source evidence. In a maintained workbook note who confirmed the mapping and what kinds of records it covers.
- Lookup key. Combine enough fields to identify one approved alias row, or match those fields separately. Keep the original components.
One exact key should have one approved match. Many aliases can map to one place, and the same alias in two jurisdictions can correctly map to two different places. Check for repeated composite keys. If an exact key appears twice but has a different result on each row, whichever row a lookup sees first could determine the label. A separate match count avoids silently trusting that choice.
Choose a matching route that preserves uncertainty
XLOOKUP with match mode 0 looks for an exact match under its normal comparison rules. It can return an explicit unknown label when a key is not found. It does not need approximate matching for this approved list. Use a separate exact match count to detect duplicate map entries. An approximate lookup can produce a value from a neighbouring label even when the intended city is absent. That is not a valid mapping for this task.
Excel 2016 and 2019 lack native XLOOKUP. With the small approved set and canonical characters, INDEX and MATCH can be used after the exact uniqueness check. Test the lookup on your edition. Some other exact lookup modes can interpret wildcard characters in a text criterion. Use a literal comparison for an arbitrary raw code and reject unapproved separators or special key forms, or design the comparison using two separate fields. The practice inputs below use a simple controlled set that fits the demonstration.
Recall. If the city spelling is known but the state is missing, why is it safer to hold the row than to pick the first result from a map?
3. Lab. Resolve aliases and explain unresolved receipts
Goal. Import ten records, keep the original text and reconcile seven accepted records and three holds. Start a blank workbook. Enter A1:D11 on Raw and duplicate it to Work. Amounts are known numeric INR, including the held rows. In the first raw city enter one ordinary space before and after pune. Do not make it fixed on Raw. Leave indicated fields blank.
| Source | Raw city | State | Amount (INR) |
|---|---|---|---|
| S01 | pune with spaces on both edges | MH | 1200 |
| S02 | PUNE | MH | 350 |
| S03 | Nasik | MH | 720 |
| S04 | NASHIK | MH | 180 |
| S05 | Sambhaji Nagar | MH | 500 |
| S06 | Aurangabad | MH | 950 |
| S07 | Aurangabad | BR | 640 |
| S08 | Aurangabad | 110 | |
| S09 | Pun | MH | 75 |
| S10 | MH | 45 |
On a sheet called Map, enter the following three source columns and add a fourth called Match key. These rows are the exercise's reviewed aliases for the stated export. Create a real Excel Table named tblCityMap with all four columns and its headers.
| State | Alias key | Canonical city |
|---|---|---|
| MH | PUNE | Pune |
| MH | NASIK | Nashik |
| MH | NASHIK | Nashik |
| MH | SAMBHAJI NAGAR | Chhatrapati Sambhajinagar |
| MH | AURANGABAD | Chhatrapati Sambhajinagar |
| BR | AURANGABAD | Aurangabad |
Prepare a key and verify the answer for each state
Build the match key in Map
In the table's Match key column use
=[@State]&"|"&[@[Alias key]]. Fill through the Table if it does not automatically calculate the column. Verify MH|AURANGABAD and BR|AURANGABAD are distinct. This simple delimiter is safe because the fields in this practice table do not contain it.Prepare source keys on Work
Put City key, State key and Composite key in E1:G1. Fill formulas E2 through G2 below down to row 11. They preserve raw columns B and C and prepare candidate keys. Normalisation handles the agreed spaces and case. Unknown Pun becomes PUN; it is still not an approved place.
Count matches before returning the label
In H1 put Map matches and in I1 put City for review. Fill down the shown H and I formulas. The first seven keys must each have one exact match. S08 says Missing state, S09 says Review map, and S10 says Missing city. Compare the output for S06 and S07. The raw city is identical and the output differs due to the state.
Check the inclusion counts and numeric balance
Use
=COUNTIF(H2:H11,1)to check seven exact approved keys. Use=SUMIF(H2:H11,1,D2:D11)to check 4540. The other three known amounts are 110, 75 and 45, totaling 230. The full source totals 4770. Keep reasons beside the held records.Prove that a map collision is visible
On a copy append a second Table row with state MH, alias AURANGABAD and a deliberately conflicting label. Verify Match key calculates on that row. S06's match count becomes 2 and its label moves to Review map. S07 still has one approved Bihar match. The accepted total under this deliberate bad map drops by 950 to 3590. Restore the original fixture.
E2 =UPPER(TRIM(SUBSTITUTE(B2,UNICHAR(160)," ")))
F2 =UPPER(TRIM(C2))
G2 =IF(OR(E2="",F2=""),"",F2&"|"&E2)
H2 =IF(G2="",0,SUMPRODUCT(--EXACT(G2,tblCityMap[Match key])))
I2 =IF(E2="","Missing city",IF(F2="","Missing state",IF(H2<>1,"Review map",XLOOKUP(TRUE,EXACT(G2,tblCityMap[Match key]),tblCityMap[Canonical city],"Review map",0))))
The formula uses XLOOKUP only when the separate exact count finds one match. Verify that the map's displayed canonical labels meet policy and are nonempty. If more than one row looks acceptable, investigate why the reference table has conflicting data before granting either label. If one approved key has been retired, keep its historical meaning available while documenting what can be chosen or matched for new records.
Read and verify the channel's context before adding a new alias
The current report's totals are Pune 1550, Nashik 900, Chhatrapati Sambhajinagar 1450 and Aurangabad in Bihar 640. Shifting only S07 to the Maharashtra label would keep the same overall accepted amount and put the wrong money in two city totals. Check one exact result from both states, not just the overall sum.
Imagine the coordinator checks the source and confirms that S09's Pun in MH means Pune. Add MH and PUN as an approved alias on the copy. Keep the original S09 raw cell. Now S09 resolves to Pune, its group's total becomes 1625 and the accepted total becomes 4615. Two holds remain with a combined 155. This update should not resolve S08's missing state or S10's missing city. A rule that clears every review outcome when one alias is added is too broad for this task.
The lookup searches for TRUE in the exact comparison results, rather than trusting a case-insensitive first match to display a verified key. This requires XLOOKUP in a supporting edition. To return the same confirmed label without it, use INDEX with MATCH on the exact comparison results in a compatible Excel version. For the tiny exercise you can also inspect the single identified row in Map and record it as a review action. The key count and amount reconciliation remain useful even when a particular lookup feature is unavailable.
As a quick source health test, use =COUNTBLANK(tblCityMap[Canonical city]) and expect 0 in the approved map. A matching key with a missing canonical label is still incomplete. Before relying on the match-count summary, verify that every accepted map row has a valid output and explicit role. A map's two columns should be aligned and its Table should include the actual populated records.
4. Lab. Limit a local replacement to an approved full value
Goal. See why a full-cell correction helps with a small rule, and where the source still needs interpretation. Open a fresh disposable practice sheet. Enter these values in A1:C7. There are no formulas in these cells. The desired change is only to write Pune in place of a raw City cell containing exactly PUNE. The longer labels can represent other types of records and remain unchanged until reviewed. Do not touch any Notes text.
| Source row | Raw city field | Notes | Expected city after approved case edit |
|---|---|---|---|
| T01 | PUNE | Near station | Pune |
| T02 | Pune Camp | PUNE venue sign | Pune Camp |
| T03 | PUNE DISTRICT | District-level row | PUNE DISTRICT |
| T04 | Pune | Already approved | Pune |
| T05 | PUNE | Stand marker PUNE | Pune |
| T06 | Nasik | Needs separate map | Nasik |
- Make and preserve a work copy. Keep the raw table available. On the copy, select only the City cells B2:B7. The Notes contain two instances of PUNE deliberately, and neither qualifies. A full-cell comparison is appropriate for this field's simple correction. If the UI scopes Replace unexpectedly, use the helper below.
- Find the exact targets before editing. Open Find & Replace on a supporting desktop build. In the Find options, use Match case and Match entire cell contents. Find PUNE and inspect the positions you intend to edit. The two eligible city cells are B2 and B6. Excel menus and scope controls can differ on Mac and in a browser. Use a preview and a small test.
- Apply the change only to those two values. On the copy, replace just the confirmed occurrences with Pune or apply a checked replacement within the verified selection. If the command shows an unexpected match count, cancel and inspect the search scope. Read the long labels and notes after the change. T02 and T03 stay distinct, and both PUNE notes are untouched.
- Compare a non-destructive formula. On a fresh copy add
=IF(EXACT(B2,"PUNE"),"Pune",B2)as a derived field and fill to row 7. It changes just T01 and T05. Reconcile six original records to six candidate records. A formula is easier to review for a future import, and the recipient can decide how to handle other spellings.
Match entire cell contents points the replacement at the complete stored expression or value as supported in the feature. Looking in formulas can find text inside formulas, so keep this demonstration to a raw text value range. For more complex source changes, keep a reviewed mapping table and work on a derived column. A whole-workbook replacement is difficult to check when the same text occurs in addresses, notes, category definitions or formulas.
Decide whether a new value is a city, an area or another field
In a fictional small store export, Sholapur could be confirmed as a legacy variant of Solapur for a particular geographic column. A text value Solapur Road in a route or address is a different field meaning. Add the first mapping only when the source confirms it and preserve the second under its proper field. Similar spelling does not prove that a route is itself a destination city.
Other exports may use legacy names such as Poona, local abbreviations or multiple languages. Create a dictionary only for confirmed examples with defined context. Make the unknown labels visible, including the full raw spelling and source ID. A map review is successful when the user understands why an unresolved line remains. It is not necessary to hide every review flag before the analyst can see the known parts of the report.
5. Design the reference for changing data
Use the source's actual reporting level
Suppose a city manager asks for the amount by current destination. A row identifying the district could be a broader area than the intended destination. Look for the field that represents the city and check whether the provider documents alternative spellings at that level. If you only have a combined place-and-address string, separate the fields using the source specification before matching. A correctly formatted city name in the wrong column can still produce an incorrect report.
In a maintained geographic table, a stable verified place ID can distinguish jurisdictions and reporting levels. The printed label can change later without changing the relationship. If the report uses a label as its key, two different locations with the same visible name can become one group by accident. Use a paired state or place code where appropriate. When a location is chosen, verify both the display and the identifier on a known row.
Keep approved and unresolved variants in separate stages
Write a short review list for new aliases seen in a batch. Include raw text, state or other place context, source ID, approved result if known and who confirmed it. Do not treat the most common city as the default for unknown inputs. In this lab, Pun stays under Review map until somebody confirms S09. A record near an unexpected city may be legitimate even if it appears once. Spelling cleanup should not reduce the visible diversity of the actual input.
A reviewed one-to-many result means the data still lack enough context. If the key contains only AURANGABAD and the reference table contains two candidate states, the proper report outcome is open. Adding a second context field can split that group into two valid keys. If the source subsequently provides an approved state for S08, you can check the appropriate mapping. A query into a chart with ambiguous single-field matches can shift amounts between cities without changing the workbook total.
Consider fuzzy matching only as a suggestion stage
Power Query offers fuzzy matching in supported contexts, where text similarity can suggest candidate matches. A similarity threshold changes which suggestions qualify. It does not prove geography, service area or authoritative spelling. Use it to offer review candidates if you need that workflow, then verify by the actual source fields before adding an approved map entry. In a small campus report, an exact reviewed dictionary is easier to explain and audit.
Test a pair you know should not merge, such as the same raw word associated with two actual jurisdictions, and a mild misspelling that should be approved only after review. If a fuzzy process runs first on City alone, that identical spelling can receive a strong match regardless of the ignored state. Increase correctness by providing the right context and by inspecting suggestions, not simply by adjusting a percentage slider.
6. Verify every row without losing its original spelling
Use the original workbook and a working copy. Read the source ID beside both the raw city and the proposed label. Compare the fixed sums by region separately from the held totals. Do not merge source rows that happen to share a new label. Grouping belongs in a summary, while the raw ledger still has one row per record.
- Confirm a known whitespace case, an alias mapping, a valid unchanged label and an unknown input.
- Confirm a case where the same text means different places in separate states.
- Confirm a missing state and a missing city give distinguishable review reasons.
- Confirm repeated map keys are reviewed rather than resolved by first match.
- Confirm the input and output reconcile by record count and amounts, with holds included in the audit.
Compare exact lookup with a left-join output on a practice copy
A recurring file can use the same approved alias table in Power Query if the Excel edition supports editing queries. Create two source tables in a test workbook: incoming records with typed City key and State key, and the approved map with the corresponding Alias key and State. Keep the original strings and row IDs in the incoming table. Pair the columns in the same order on both sides and set both key fields to text. Use an exact Left Outer merge so the original records remain present, including those without an approved result. The terms Left and Right refer to the selected tables' roles in the merge dialog.
Inspect the nested right-side result before expanding it. In a compatible editor, if the merged column is named CityMatches, add a custom count with Table.RowCount([CityMatches]). Read seven rows with count 1 and three with count 0 for our original fixture. An unmatched row still belongs to the incoming list and should receive its review label. If the query merges an unknown to a blank map row, check the map source and clean failed keys explicitly. The reviewed map contains no blank key in this exercise.
Try the same duplicate MH test in the optional query. After expanding an unguarded two-row match, the expanded table can contain two copies of the incoming S06 information. Our ten original rows would appear as eleven and the known raw amount would look like 5720 instead of 4770 if all expanded rows are summed. The extra 950 is the repeated original amount. Nothing arrived from a new receipt. Count the matches per source row before expanding and keep unresolved or multiply matched keys in a review branch.
When you design a scheduled report, keep the exact checked map near the query so a future editor understands its authority. An endless list of guessed aliases is not an improvement over manual editing. A refresh can produce the same wrong join rapidly if the map includes a duplicate. Test the first file and a second file with an intentionally new alias. A clear error or hold can be a correct result. Do not abandon it just to get every row into a published city group.
Check a counterexample for each part of the key
Try the lookup with state BR and alias NASIK in a copy. There is no approved combination even though NASIK exists as a Maharashtra alias. The appropriate lab result is Review map. Try MH and NASHIK and verify one exact match. Try Maharashtra's Aurangabad and independently check Bihar's with the same raw letters. The two outcomes are a direct test that the state context is really part of the key. Reading matching counts alone would not show the difference if you returned the wrong label after the match.
For another error control, put two entries for an alias whose display differs only in case. This may seem like harmless duplication. If the source map is meant to be canonical uppercase, normalise its keys under the same rule as the incoming candidates and check the result. Our I formula looks up TRUE in an EXACT comparison array so it uses the same comparison as the preceding count. A first-match search on the raw mixed-case columns could choose a row that the exact audit did not count. Use one clearly defined comparison across validation and lookup.
Check that the map never uses alias separators inside key pieces when you build a concatenated key. If one field can contain a vertical bar, different field pairs might concatenate to the same text. A multiple-column join or separate corresponding equality tests avoids that ambiguity. The formula is simple because the exercise's state labels and city tokens are restricted. Audit the new source for unknown key shapes if the rules change later.
Explain what should happen to old reports after a map update
Consider the earlier reports where a historical spelling appears. The owner may request a current view that groups old and new names together. Another owner may need the original name as it appeared on the source record. Keep a readable label such as Raw place at time of order and another as Current reported place. If someone looks for a change in performance over time, they should know whether the label changed or the orders moved. Stable place codes can preserve the link without rewriting history.
Store the map's source version in a small visible field if the results need to be reproduced. After adding Pun as an approved alias, a later refresh may include S09 where the earlier report held it. Document that explainable 75 INR difference. Keep the previous 4540 publication and the approval note so the team can tell that no new receipt was invented. Confirm both totals reconcile to the raw known 4770 at the same source scope.
When an approved name changes, update the mapped output and any documented reporting labels rather than doing a broad replacement in the input. Check for the old and new spellings in a tiny output subset. The raw export should still show the original record. A descriptive change log can mention the old label, new label, place level, state and date approved. The purpose is to let the next analyst reproduce the decision from evidence.
Use separate review outcomes when geographic context is incomplete
The exercise distinguishes missing city, missing state and a present but unapproved city/state pair. That distinction makes the work queue actionable. S08 needs the state before the two valid meanings can be separated. S09 has a place-like spelling but requires a mapping decision. S10 lacks the raw city entirely. Combining them into an empty output hides the differing reason. If your report needs a single combined hold count, you can still calculate it from the review statuses.
An unexpected state code could also deserve its own message instead of the generic Review map. In a real workbook with several jurisdictions, validate approved state codes separately and check whether the state is consistent with the source. Avoid inferring with phone numbers or names alone. Use verified addressing data and the business purpose. Where the location is not required for a broader total, set that aggregate's scope explicitly instead of silently rewriting an ambiguous row.
Keep the report's evidence available to someone learning by example
- Choose one exact known label and one policy-approved alias. Write the expected output beside the source values in a practice copy.
- Choose a second state that shares a name with the first. Check both outputs by source ID, even if their amounts happen to match.
- Check one missing context and one conflicting map row. Both need distinct reasons in the review fields.
- Compare the known source amounts before and after mapping without dropping rows. Check the accepted, held and per-city totals separately.
- Verify a one-time full value correction does not edit notes or longer strings. Save the safe operation as a reproducible helper when the source refreshes often.
Ask the next learner to recreate the outcome of just one ambiguous record. If they need to guess whether Aurangabad was Maharashtra or Bihar, the template still lacks evidence. If the reviewed state and matched key are visible, they can understand why the approved labels remain distinct. This is the difference between a tidy report and one that can be audited from its original place data.
Use the existing Excel Task Hub with its own practice map. Before applying a possible alias from a report, ask whether the prompt supplies enough location context and an approved meaning.
Validate an incoming batch before refreshing the report
Imagine the approved map is ready and a separate organiser sends a second list. Before reusing the first workbook, ask which columns are supplied and how they are defined. Its column called City may be a destination on one export and a preferred pickup location on another. The source still needs to represent the same concept for these labels to appear together in the published group. If the organiser supplies both fields, keep both on the raw sheet and choose the one named in the reporting request.
Add the second batch to a copy, then test the rows by source identifier rather than visual order. Take one approved alias from the old export, a matching raw spelling with a different state and a missing state from the new one. Predict their outcomes first. If the first result changes unexpectedly, inspect whether the input carried an invisible character or a different code. If the second disappears into the first group, check the order and content of the fields used in the key. If a missing state produces a city anyway, identify the formula branch or the step that supplied it. These controls detect separate problems.
Choose a single owner for changes to the reference map and make each accepted addition transparent. Suppose two reviewers independently handle Pun and one suggests Pune while the other suggests putting it in a generic group. The duplicate count protects both proposed meanings from becoming a silent output. Agree the raw place and reporting scope, choose one canonical label with evidence, and leave a dated note. When both rows are genuine alternatives, keep the alias unresolved until another field identifies the place. A key can be unique while the decision behind it still needs proof.
When comparing reports from two dates, include counts as well as money. One accepted receipt and two held refunds could leave the net amount unchanged even though the group has changed. The row disposition exposes that movement. The training table uses positive numbers to make the first balance easy to follow. Reuse the same reconciliation separately for signed amounts and number of records when credits are part of your source.
7. Interview questions with practical answers
How would you standardise different spellings of a city?
Preserve raw values, create a controlled comparison key and look up a reviewed alias table with context. Verify known matches, ambiguous rows and no-match behavior. Reconcile city results and held values separately.
Why can the same spelling require different mapping results?
Different places or reporting levels can share text. In the exercise, Maharashtra and Bihar resolve Aurangabad differently by reviewed state context. I would hold a row missing the required state.
How do you avoid returning an incorrect first result?
Check for exactly one approved key using explicit comparison logic. If duplicate or conflicting map entries remain, return a review status instead of trusting whichever one happens to come first.
When would you use Find and Replace?
For a small, confirmed full-token correction in an isolated copy. Inspect the target range and expected original cells before changing anything. For repeated imports, use a visible mapping helper so unknown inputs remain inspectable.
How would you trial fuzzy suggestions?
Require geographic context and treat any similarity result as a review candidate. Compare with approved source data, reject ambiguous matches and add only confirmed aliases to the reference table.
8. Predict the result of the approved map
Should a raw Pune with ordinary edge spaces map to Pune in this exercise?
Answer and reasoning
Yes, if the state is the approved MH input and the controlled comparison normalises those spaces. The original spaced string stays in Raw.
How should the result handle Aurangabad with no state in the sample?
Answer and reasoning
Hold it as Missing state. The raw text can refer to different places and there is no approved context for this record.
Will a correct exact case edit turn Pune Camp into Pune?
Answer and reasoning
No. Pune Camp is a longer label outside the stated full-value correction. Its geographic meaning requires separate confirmation.
What can change when there are two Map rows for the same exact key?
Answer and reasoning
The collision should be flagged. In the practice control S06's count becomes 2 and it is excluded from the approved sum until the map has one intended entry.
If the raw total matches but a city subtotal changes, what should you inspect?
Answer and reasoning
Check which row IDs were reassigned, what context justified the new label and whether all accepted groups still reconcile. A constant overall amount alone does not validate categorisation.
9. Six reminders
- Keep raw spellings
Canonical labels and typed values have different jobs. Preserve the source row and original text.
- Resolve the correct geography
Match the level, state and intended identity. Similar words do not prove an equivalent place.
- Use an approved map
Keep one result per exact key and explicit review messages for new variants.
- Scope a replace operation
Check actual cells, match the full word field and keep addresses or notes outside the operation.
- Separate a suggestion from approval
A fuzzy match can suggest a candidate. Confirm it before printing a canonical name.
- Check counts and money
Verify accepted and held rows, original totals and correct region subtotals.
Microsoft references
- Find and Replace options and scope
- Prepare and preserve original values
- XLOOKUP exact mode and supported versions
- Legacy lookup options
- Check exact matching characters
- Count corresponding match results
- Exact merges and matching field order
- Count matches before expanding a query result
- Power Query similarity and reviewed transformation tables