26. Excel Tricks Every Analyst Should Know
Practice and Answer Key: Clean and Summarise a Messy Export
Goal of this practice: Use six tricks from this module to clean a messy export and summarise it by city.
या practice चं ध्येय: या module मधल्या सहा tricks वापरून messy export साफ करा आणि city प्रमाणे summary बनवा.
इस practice का लक्ष्य: इस module की छह tricks से messy export साफ़ करें और city के हिसाब से summary बनाएँ.
Suppose Shahrukh receives a fictional export of 8 order rows (A1:C9). Some cities have extra spaces, some City cells are blank (the city is the same as the row above), the amounts are stored as text, and one order appears twice. All data is fictional practice data.
| A: Order ID | B: City | C: Amount (text) |
|---|---|---|
| BLK-2001 | ·Pune | 450 |
| BLK-2002 | (blank) | 120 |
| AMN-2003 | Nashik· | 95 |
| BLK-2004 | (blank) | 300 |
| BLK-2002 | (blank) | 120 |
| AMN-2005 | Kolhapur | 210 |
| BLK-2006 | ·Kolhapur· | 180 |
| AMN-2007 | Nashik | 75 |
Exercise (one under the other):
- Clean the City column with TRIM (trick 5).
- Fill the blank cities with the value above (trick 2).
- Convert Amount to numbers with VALUE (trick 6).
- Flag duplicate Order IDs with COUNTIF (trick 18), then remove them (trick 7).
- Make a PivotTable of Sum of Amount by City with % of Grand Total (trick 27).
- Paste Values before sending (trick 29).
Expected result (check your numbers):
| Check | Expected |
|---|---|
| Rows after removing duplicates | 7 |
| Duplicate removed | BLK-2002 (second copy) |
| Total amount | ₹1,430 |
| Pune | ₹570 (39.9%) |
| Nashik | ₹470 (32.9%) |
| Kolhapur | ₹390 (27.3%) |
Answer key (open after you try)
D2: =TRIM(B2)
D3: =IF(TRIM(B3)="",D2,TRIM(B3)) (fill down to D9: a blank City takes the cleaned city from the row above)
E2: =VALUE(C2)
F2: =COUNTIF($A$2:$A$9,A2)>1 → TRUE for both BLK-2002 rows
Check both BLK-2002 rows before removing one: the first copy is in Pune, but the repeat sits under a Nashik row, so its blank City fills as Nashik.
In this practice the export repeated the Pune order by mistake, so keep the first copy and remove the second.
Copy D2:E9 and Paste Values, then Data › Remove Duplicates on Order ID
PivotTable: Rows City, Values Sum of Amount, Show Values As › % of Grand Total
Why not Go To Special › Blanks on column D? A cell that holds =TRIM(B3) is not empty, even when it shows nothing, so Go To Special does not select it. Fill the blanks with the IF formula above, or fill the blanks in column B first and then use TRIM.
Common mistakes:
| What you see | Why | Fix |
|---|---|---|
| Kolhapur appears twice in the PivotTable | One value still has a space | TRIM the column and paste values before pivoting |
| Total is 0 | Amounts are still text | Use VALUE or Convert to Number |
| A blank city row is filled with the wrong city | You sorted before pasting values | Undo, paste values first, then sort |
| Total is ₹1,550 | Duplicate BLK-2002 not removed | Remove Duplicates on Order ID |
Ravindra Bagale's rule: clean first, check counts second, summarise last.
Quick recap
- Ctrl+Enter fills a formula into a whole selection; Go To Special › Blanks fills gaps.
- TRIM, VALUE, Remove Duplicates and Text to Columns fix most imports.
- Visible cells only, the Name Box and Find All select exactly what you need.
- F4, Evaluate Formula and Show Formulas keep formulas honest; IFERROR and XLOOKUP messages keep them readable.
- Row highlights and Center Across Selection format for reading, not decoration.
- Total Row, % of Grand Total and date grouping summarise; Paste Values makes a safe copy to send.
Loading practice tasks...
- Clean one city (Easy): The City of order BLK-2001 has a space in front. Show the city without the extra space.
- Turn one amount into a number (Easy): The Amount of order BLK-2001 is stored as text. Turn it into a real number.
- Count the order rows (Easy): How many order rows does the export have, before any cleaning?
- Is BLK-2002 repeated? (Easy): Does the Order ID BLK-2002 appear more than once? Answer TRUE or FALSE.
- Total before removing the repeat (Medium): Add up every Amount, including the repeated BLK-2002 row.
- Total without the repeat (Medium): Add up every Amount, then take away the Amount of the repeated BLK-2002 row in row 6.
- Count the different orders (Medium): How many different Order IDs are there?
- Kolhapur amount (Medium): Add up the Amount of every order whose City is Kolhapur once the spaces are removed.
- Pune amount after filling blanks (Hard): Row 3 has a blank City, so it belongs to Pune from row 2. Add the Amounts of rows 2 and 3.
- Nashik amount without the repeat (Hard): Rows 4 and 9 say Nashik, and row 5 is blank, so it belongs to Nashik from row 4. Row 6 is the repeated BLK-2002, so leave it out. Add up the Nashik Amounts.
- Pune share of the clean total (Hard): What share of the clean total of 1,430 comes from Pune? Round to 3 decimals.