17. Interview Questions and Answers
17.4 Data Cleaning and Preparation
Describe the change, the reason for it and how you confirmed that every source record was accounted for. These interview questions cover duplicates, missing data, dates, text parsing, outliers and mismatched lists.
Q29. Define a duplicate using the meaning of a row
Decide whether a repeated value represents the same thing
Two deliveries can go to Pune on the same date. Removing one because the city repeats would lose a real record. If the export is supposed to contain one row per order, check repeated Order IDs. If the export contains one row per item within an order, the order ID repeats legitimately. In that file use another field such as line ID as part of the row key. When an interviewer says remove duplicates, ask which row is supposed to represent which event or entity.
Imagine a fictional Swiggy-style distribution team sends a small report to an analyst. It documents one deliberate retry for order E701. That retry is safe to exclude from a clean view after confirming the ID, expected source event, amount and date agree under the accepted rules. A new entry with the same ID but amount 105 instead of 100 could represent a correction, a conflict or an error. Both variants should remain available for review. A duplicated key flags a question. It does not automatically specify the surviving row.
Explain the effects of three tools
- Identify repeats. Conditional formatting or a COUNTIF can show your selected values that repeat, allowing review without removing rows. An expanding count tests the number of occurrences seen so far in that order.
- Produce a distinct list. UNIQUE in versions that support it can return the distinct values in one selected field, or distinct rows across a selected array. It provides a separate result. Passing a whole record can keep both rows of a repeated key if another field differs.
- Remove confirmed duplicates. Excel's Remove Duplicates changes the selected data and uses its selected comparison fields. Work in a scratch copy and record what was removed. A repeatable Power Query output can use recorded steps, but choose an explicit rule when the survivor matters and verify the loaded output.
To illustrate the review step, put raw keys in B2:B7 and add a normalized key in F2. This fixture defines ordinary surrounding spaces and case as insignificant. Verify that this is appropriate for the actual records. Copy the two formulas down the indicated columns on the practice sheet. The second expression reports whether a normalized key already occurred in the earlier rows, including the current one. By inspecting the duplicate rows before exclusion, you keep their differences available for review.
=UPPER(TRIM(B2))
=COUNTIF($F$2:F2,F2)>1
Move the second expression to G2 before copying. Its fixed first row expresses the beginning of the check and its moving last row changes through the file. If order changes, the row flagged as later can change. A repeatable pipeline needs stable source ordering or an explicit selection rule for corrections. Avoid drawing a guarantee about which Power Query duplicate row survives from a visual preview. If all repeat rows have equal canonical payload and no downstream ordering dependence, document that their exact position is immaterial to the accepted record.
Q30 and Q31. Make missing policy part of the cleaning plan
Separate unknown from an observed zero
A delivery with amount zero could be a genuine approved waiver. An empty amount could mean it has not been submitted. If you put zero everywhere a value is missing, a total can stay unchanged while the average changes. With validated amounts 100, 0 and 180 and one missing value, the observed average is 280 divided by three, about 93.33. Filling that missing value with zero changes the calculation to 280 divided by four, or 70. Explain whether the question asks for an observed average or a model with a documented imputation. The two results cannot be compared without describing the denominator.
Check the three common blank-looking cases separately. A truly empty cell has no stored contents. A formula may emit empty text so that a pending row looks blank. A cell containing a space can display blank while containing a character. COUNTBLANK can include empty text, while Go To Special blanks and ISBLANK concern genuinely empty cells. Power Query represents missing data through typed values such as null, and empty strings and parse errors need a deliberate rule. Keep a Count missing field or review list when a shared output needs evidence of omissions.
Tell the interviewer the order of decisions
- Keep the acquisition. Retain a copy of the source and its filename and export time. Capture a stable source row identifier so you can explain the effect of sorting and filtering.
- Inspect the structure. Name the intended headers, possible extra rows and data shape. Check the row count and which fields define a source record before typing or deleting anything.
- Apply approved rules. Parse amounts and dates using their source conventions. Keep leading-zero IDs in their intended text form. Map known labels without guessing at unknown ones.
- Route exceptions. Identify retries and conflicts, flag unresolved inputs and preserve the reason why a row did not reach the accepted output.
- Reconcile and document. Compare row counts, unique keys and totals at each stage. Report separately how many missing values remain and whether the published measure uses the observed rows only.
To answer an interviewer plainly, say that cleaning makes a source usable for a stated purpose. Work out the data contract and retain the raw evidence. Apply consistent type and naming rules and create a separate exception path. Compare known rows and totals before approving the result. Repeat the process on a deliberate test file with a new invalid date or repeated ID. A successful refresh or fewer visible rows cannot alone verify that cleaning did the right work.
Q32. Interpret text dates before formatting their display
Check what the date string actually means
A slash date such as 03/04/2026 can mean April 3 under day-first conventions or March 4 under month-first conventions. Changing a date format affects the display of a real date serial. It cannot decide which event day a raw string was intended to represent. Ask for the source convention, preferably from the supplier's schema or agreement. Separate M/D/Y and D/M/Y source files or carry a trusted source tag if they arrive mixed. Without a trusted convention, send ambiguous text to review instead of parsing using whatever locale happens to be active.
When your experiment uses 04/03/2026 from a month-first source and 03/04/2026 from a day-first source, both describe April 3. A source date with 22/04/2026 helps confirm day-first behavior. If the parser incorrectly treats 22 as the month, it should produce a diagnostic, not a confirmed date. Date helper formulas based on DATE can roll out-of-range components to another month. Compare the parsed day, month and year back to the source components when validating real-world date strings. ISNUMBER can distinguish a stored number from text, but a random number is not automatically an accepted date.
Lab one. Prepare an accepted view and account for all inputs
Put source row, raw ID, raw city, raw date convention and raw amount in a scratch workbook. Add raw date text between city and convention, preserving fields A through F in that order. Before entering the raw date strings, set their column to Text so your active locale does not convert them as you type. The label quotes in the table indicate surrounding spaces or text presentation for the practice. The quotes themselves are not part of the stored string. This small fixture is fictional. Each accepted Order ID represents one order, and one documented retry is intentionally included.
| Source row | Raw ID | Raw city | Raw date | Convention | Raw amount |
|---|---|---|---|---|---|
| R1 | E701 | Pune | 03/04/2026 | DMY | 100 |
| R2 | “ e701 ” | “ pune ” | 03/04/2026 | DMY | 100 |
| R3 | E702 | Mumbai | 04/03/2026 | MDY | 0 |
| R4 | E703 | Nashik | 22/04/2026 | DMY | Missing |
| R5 | E704 | Pune | 24/04/2026 | DMY | “180” |
| R6 | E705 | Pune | 03/04/2026 | Unknown | 900 |
In this lab the source row is in column A, ID in B, City in C, raw date in D, convention in E and Amount in F. For this combined fixture place normalised ID in G and the repeat flag in H, adapting the earlier standalone formulas to G. Use numeric zero for R3 and a truly empty F5 for R4. Enter R5's 180 as text before deliberately converting it in a clean helper. Keep F unchanged. Name the seasonal case in your scratch workbook so it cannot be confused with a real file.
=UPPER(TRIM(B2))
=COUNTIF($G$2:G2,G2)>1
- Copy the normalised ID and repeat flag down the source rows. The accepted order key E701 appears in both R1 and R2. The practice agreement identifies R2 as a retry of R1. Confirm its canonical payload agrees before setting that row's clean disposition to Approved retry.
- Check the clean cities using a small approved spelling map. Keep the raw Pune and lowercase surrounding-space variant available. After standardising the label and key, the reviewed retry should refer to the same date and amount as R1.
- Use the source date convention to create true dates in a separate clean column. For the practice you can explicitly enter DATE(2026,4,3) for R1 and R3, DATE(2026,4,22) for R4 and DATE(2026,4,24) for R5 after interpreting the raw strings. In a repeatable supported query, split by verified convention and apply Change Type Using Locale to each known source's date field before recombining. Mark R6 Review date rather than making a date from its unknown convention.
- Convert the accepted text amount 180 deliberately with VALUE in a helper or the supported data-type step. Verify it becomes numeric and agrees with the intended source. Preserve numeric zero on E702 and leave the missing E703 amount missing while recording its status. This fictional process accepts an order record with no amount for a completeness report but excludes it from an observed-amount mean.
- Build an accepted output with E701, E702, E703 and E704. Write one review row for R2 and one for R6. Check the accepted numeric count is three and total is 280. Verify that all six source rows have a documented outcome. Retain the original acquisition separately and discard experimental copies at the end.
Follow one repeated order while preserving the raw data
Find the stored ID
R2 has e701 in lowercase with surrounding spaces. Its raw value remains available.
Compare the approved key
The fixture trims and uppercases the key, so R1 and R2 both map to E701.
Verify the agreed duplicate
Both source payloads describe Pune on April 3 with amount 100. The source confirms R2 is its retry.
Account for both rows
R1 supplies the accepted order. R2 has its own approved retry reason in the review view.
A reconciliation of raw and accepted numeric amounts also needs types. If you add only genuine numeric cells in the raw Amount field, the text 180 is not counted. The raw numeric subtotal is 1100 from 100, 100, 0 and 900. After normalising only the valid numeric text in the full staging copy, the amount becomes 1280. Removing the approved retry amount 100 and holding the unresolved date's 900 explains the accepted 280. The missing value remains unknown through the comparison. Checking totals from differently typed stages as if they used the same rules would obscure exactly that difference.
If someone confirms that the unresolved text came from a day-first source, use a separate clean rerun with that approved metadata. The result for E705 should then be April 3 and the accepted order count becomes five. The numeric total becomes 1180, three original amounts plus one newly accepted value. The source still has six rows and the one approved retry remains. If a budget report changes by 900 after this confirmation, explain that it arose from a newly accepted source record and identify its key.
Q33 and Q34. Choose between splitting formulas and a one-time example tool
Preserve the pincode while testing the delimiter rule
For the baseline practice string Pune-411038 a dash separates the city and pincode. If its schema allows exactly one dash, a Text to Columns step can separate it into two fields. Verify that the original string is preserved before writing to nearby cells, and set the pincode output to Text where supported if leading zeroes are meaningful. A formula based on FIND and LEFT can produce the city, while MID reads the remaining six characters. A rule that merely takes six characters may quietly truncate an invalid longer suffix. Validate the shape and allowed characters before publishing it as a confirmed code.
=LEFT(A2,FIND("-",A2)-1)
=MID(A2,FIND("-",A2)+1,6)
=TEXTBEFORE(A2,"-",-1)
=TEXTAFTER(A2,"-",-1)
The last pair is useful in versions supporting TEXTBEFORE and TEXTAFTER if the specification says the last dash is the separator. A negative instance searches from the end. Use a scratch text value Navi-Mumbai-041038 and predict city Navi-Mumbai and text code 041038. Codes in this exercise are synthetic. A split at the first dash does not supply the intended city and code when a city label has a dash. Verify the output's length and text type using the actual source rules. Some malformed inputs contain no dash at all and need a review outcome.
Describe what Flash Fill keeps when inputs change
Flash Fill derives a pattern from examples and fills output values. In supported desktop Excel, type the expected result beside the first one or two examples, use Data then Flash Fill or its supported shortcut, and inspect the preview and actual filled cells. A person can reuse it for a one-time work copy. The filled values do not gain formula dependencies on the source. If A2 changes later, the output previously filled by the pattern can stay as it was. A formula or a repeated query transform can reproduce an agreed rule when input changes; verify the actual refresh path if using a query.
- In a supported scratch workbook put Pune-411038 and Nashik-422001 in A2 and A3. Supply Pune as the first example city and test the resulting value on Nashik.
- Add a deliberately more difficult hyphenated label and a code beginning with zero. Inspect the resulting content and determine whether it matches the required last-dash rule. Retain the original code in a visible source column.
- Change the source city of the first row in the practice copy. Previously Flash-Filled data may still show Pune. A correct formula pointing to that source updates when recalculated.
- Compare the two workflows using a known malformed record. Choose a method that exposes a review case and keep a way to trace the source and output side by side.
If the interview question asks only whether you know the feature, answer concisely. "I give Flash Fill a few examples and inspect the filled values. I use a formula or a query when the same rule must keep working on changed inputs. For city and pincode I check embedded dashes and leading zeroes." This describes when the feature fits and how you detect the ordinary failures without a long feature tour.
Q35 and Q36. Distinguish an unusual value from a mismatched record
Lab two. Flag a long duration and check order list differences
Imagine a fictional grocery service quality file with elapsed minutes 10, 12, 14, 16 and 120. Put those genuine numbers into J2:J6 on a disposable sheet. An outlier is a value that differs markedly under a defined rule. The interquartile range is the interval between the lower and upper quartiles, Q1 and Q3. An inclusive quartile calculation on this five-value fixture puts Q1 at 12 and Q3 at 16. The gap is four. Multiply it by 1.5 and subtract from Q1 or add to Q3. The resulting fences are six and 22. Values strictly outside them are flagged for investigation.
=QUARTILE.INC(J2:J6,1)
=QUARTILE.INC(J2:J6,3)
Use the first in K2 and the second in K3. In L2 calculate =K3-K2. In L3 calculate =K2-1.5*L2 and in L4 =K3+1.5*L2. In M2 enter =IF(OR(J2<$L$3,J2>$L$4),"Review","Within fences") and fill through M6. The rate multiplier here is a statistical screening convention. It does not estimate a probability or establish that the 120-minute record is a mistake. Ask whether a genuine operational delay, a clock defect or a source-entry error explains it. Document the known input and calendar or units as part of the inquiry.
- Verify the ordered values and expected quartiles, IQR and fences. Only 120 is marked Review. The final value may represent a genuine long delay.
- Replace 120 with 22 in another copy. The second and fourth positions stay 12 and 16, so Q1 and Q3 do not change in this five-value fixture. At exactly 22 the rule with a strict greater-than result labels the value Within fences. Restore the original outlier.
- If your filter shows many flags, check for mixed units. A 120-second record means two minutes after correct conversion. The values in this practice already use the same unit. A z-score alternative needs a meaningful distribution and a nonzero sample standard deviation; choose and state its population and cutoff.
- On another part of the sheet put the accepted order IDs E701, E702, E703 and E704 in N2:N5. Put the expected upstream IDs E701, E702, E704 and E706 in O2:O5. Each key is a clean text ID in this fixture. To find accepted values absent upstream, enter the first formula below beside N2 and copy down. To find expected keys absent from the accepted data, use the second formula beside O2 and copy down.
=ISNA(MATCH(N2,$O$2:$O$5,0))
=ISNA(MATCH(O2,$N$2:$N$5,0))
The first pass flags E703 only. The reversed pass uncovers E706 only. Their list counts are both four, so equality of row count is too weak. Sorting both lists and comparing corresponding rows would answer a position question. Here exact membership is intended, which allows unrelated order. In Power Query a left anti join on the typed key expresses the first comparison by returning rows on the left without a right-side match. Reversing the table roles gives the opposite difference. Use a reliable unambiguous comparison and retain each missing key with its source and reason.
Choose a separate test if two lists can contain repeats
Match membership for each key separately from multiplicity. Two copies of E701 and one E702 can have the same distinct keys as one E701 and one E702. A membership test flags no new missing key, even though one list has an extra occurrence. Count per key on each side when all occurrences matter. If a lookup key includes allowed wildcard characters, remember that exact-mode MATCH can interpret wildcard patterns in text lookups. The sample alphanumeric IDs contain no wildcard characters. For a different policy use a comparison appropriate to literal key characters, with a separate explicit case rule if needed.
For a row-by-row comparison of deliberate paired text strings, EXACT uses case-sensitive text comparison. It is useful in a source exercise where capitalization distinguishes valid file label variants. Apply it only after you know the compared cells represent the same intended record. Two lists sorted differently can have the same membership but fail several row-by-row comparisons. If case-sensitive membership is required, use a design that evaluates those literal comparisons across the search scope. Test mixed-case examples and retain the differing identifiers rather than correcting all capitalization by default.
Read a cleaning report in the order its decisions were made
Write that the practice export had six raw source rows, four accepted orders, one documented retry and one unresolved date. Separately state that three accepted amounts contribute to 280. If the report shows the amount completeness rate, its numerator is three numeric accepted amounts and its denominator is four accepted orders, giving 75 percent. Check what counts as complete before applying this rate to a separate dataset. A raw row held for a date review does not become an accepted order merely because its amount is known. A key comparison can show when the status of a record changes after resolving a held case.
When you finish, keep only the approved training copy and evidence table. Do not paste cleaned data over a source you need to preserve. A handoff column can show clean value, raw value and review reason for each unresolved field if your data access permits it. Reconcile excluded amounts only where a numeric representation is valid and currency units match. If a source has dollars and euros, record the currency for each amount and use an approved conversion or separate totals. Numeric type alone supplies no currency meaning.
- Expected date. Verify the day, month and year for an ordinary ambiguous input and one revealing day above 12.
- Expected amount. Check the deliberate zero, accepted text conversion and genuinely missing value individually.
- Review evidence. Preserve one example each of a confirmed duplicate, unresolved ambiguity, a long transaction and unequal membership.
- Cleanup. Restore original fixtures after controlled variants, or discard their practice copies.
Quiz. Use the evidence behind each result
Why do the six raw rows produce four accepted orders?
R2 is a documented retried row for E701 once the key and payload agree. R6 has a date string with unresolved source convention. Each receives a different review disposition. The other four rows remain accepted identifiers.
Should the accepted missing amount be filled with zero for the observed average?
Keep the missing amount separate. The three observed numeric amounts total 280 and average about 93.33. Imputing another zero would divide by four and produce 70, which requires a specific approved rule.
When does 03/04/2026 mean April 3?
It means April 3 under day-first order. The same raw string with month-first convention means March 4. Changing the visible format cannot decide which source event took place.
Will a Flash-Filled pincode change immediately if the source changes?
The generated output is a value and has no dependency on the original source cell. Repeat and check the extraction if using it again, or use a formula or agreed refresh workflow for recurring inputs.
What makes 120 a review case under the quartile rule?
Q3 is 16 and IQR is four. The upper boundary is 22. The 120-minute value exceeds it. A value at exactly 22 does not exceed the boundary under the displayed strict comparison.
Which matched counts can conceal differences between the order lists?
Both lists contain four entries, but E703 appears only in accepted and E706 only in expected. Check both directions by literal tracking key. When duplicates matter compare counts per key as well.
Model answers for a spoken rehearsal
How do you approach a file with repeated order rows?
I identify the grain and official key, preserve the raw data and flag repeat keys. In the practice export I reconcile both E701 payloads and confirm the registered retry before excluding its later copy. A changed payload would go to review.
How would you handle mixed date conventions?
I identify trusted source conventions before parsing ambiguous strings. I parse each known group with the documented locale or specific date components, then verify actual day, month and year. Rows without a rule get a review reason before aggregation.
When does simple text splitting become unsafe?
When the delimiter can occur within a field or the output type can drop significant characters. If the specification says the last dash separates a text code, I test a hyphenated city and leading-zero code and preserve the original input.
What would you do when an unusual value is flagged?
I verify the source, unit and reason for the flag before changing anything. In the practice interval the 120 elapsed minutes exceed 22, but can represent a genuine event. Check the source and review with the process owner.
How can you show a clean report did not lose an unrelated order?
I reconcile original row dispositions, accepted keys and numeric amounts and compare lists in both directions when expected keys are available. I include test cases for repeated keys, deliberately absent keys and distinct field types. Totals alone cannot establish membership.
Recall cards
Duplicate policy
Define one row, its unique key and the rule for conflicting payloads.
Observed zero
A recorded zero is a real amount. Missing data changes the meaning of the denominator.
Locale before display
Pick a verified source convention before converting a text date to an actual date.
Delimiter and types
Specify which delimiter occurrence separates fields and preserve significant code characters.
Outlier review
A threshold makes a case visible for inspection. Verify whether it represents a valid event.
Distinct membership
Check source A against B and B against A. Compare multiplicity separately if duplicates matter.
Official references
Test a later export with both a conflict and a repaired convention
Keep two versions of the same input separate
An analyst interview often changes the data after you explain the first workflow. Take a disposable copy of the six-row fixture. Replace R2's amount 100 with genuine numeric 105. The key is still E701 and the date remains April 3, but the payloads differ. The first-occurrence formula alone still marks R2 as a repeat. The original acceptance rule required evidence it was the same retry. Do not reinterpret the R2 row as a confirmed duplicate. Keep both raw rows and route the conflict to review. An authorised source owner can confirm whether one value is final or whether this export represents a different useful quantity.
For a clearly testable alternative, adopt a conservative temporary rule for the changed copy. Hold both conflicting E701 rows out of the accepted set while awaiting a decision. Preserve their source IDs R1 and R2 and raw amounts, then write a single conflict case linking them. The accepted set now includes E702, E703 and E704. It has three records and two observed amounts adding to 180. R6 remains unresolved. The raw record reconciliation is three accepted plus two conflict rows plus one unresolved date row, all six accounted for. A report of four only because one E701 silently remained would conceal the conflict.
Suppose the source owner validates both that R2 amount 105 is the corrected amount and that R6 came from a day-first source. Now accepted keys are E701 through E705. The former R1 receives a superseded disposition and R2 provides the confirmed 105. E702 contributes zero, E703 remains missing, E704 contributes 180 and E705 contributes 900. The accepted numeric total becomes 1185 across four observed amounts and five accepted order records. Against the base accepted 280, the change of 905 consists exactly of the corrected increase of five and the newly accepted 900. A changed pipeline output is expected here; show the two reasons instead of trying to force the old amount to match.
Document which candidate list a reconciliation uses
The original expected list E701, E702, E704 and E706 is a separate upstream control. If someone confirms E705 as accepted but does not update that control, E705 should now appear as another left-only key. E703 remains left-only and E706 remains right-only. This result may mean the two lists represent different business scopes. Check owners and batch windows before deleting a row that has no upstream match. A valid order with a pending amount could intentionally be absent from a finance posting list while still appearing in an operations register.
Use these two follow-ups to practise the difference between a data error and a business explanation. Wrong types, missing metadata and repeat keys can be detected with defined checks. Accepting a revised amount needs a source decision. A cleanup worksheet that gives you the power to edit a value does not confer that business authority. A reproducible handoff carries the original field, accepted field, authorising confirmation and reason when the data can be shared with the reviewer.
Explain how to prepare a repeatable check across new inputs
Use named stages to identify which action changes which field. An acquisition stage retains dates as text and tracks the source. A typing stage converts known date patterns to genuine dates and flags invalid inputs. A review stage identifies matching identities, exact agreement and approved replacements. A report stage consumes only accepted records and explicitly states missing fields. In Power Query, another monthly file can run through saved transformation steps after the source, privacy and credentials are configured for the supported workbook. Inspect the actual loaded output for the new batch. A preview or a step name cannot show that errors were handled correctly or the final published workbook reached the new period.
Build one new test file containing day 29 in February of a non-leap year, an unexpected file schema and an ID with a leading zero. The invalid date needs review, a renamed required column needs a diagnostic, and an identifier such as 0007 retains its full text. If a custom parser maps February 29 to March 1, comparing extracted components detects that roll-forward. Do not just check that a date serial resulted. For text calculations, compare the output string to its known characters and length. A visual display of 0007 alone could be four-character text or numeric 7 given leading-zero display format.
After completing these controls, note which order of processes assumed a stable source. On a live project people can change files while review is under way, and a new export can invalidate a comparison. Match the report back to its documented raw input. Keep the test cases and observed outputs in a training workbook separate from production. Each answer should explain whether the test confirms source contents, parsing, record selection or published output.
For a rerun, record the changed facts before touching the worksheet. In the revised practice the confirmed date adds E705 and its 900, while the approved correction increases E701 by five. Check the new report against both changes individually. If the total increased by 900 alone, the pipeline likely accepted the date update without selecting the corrected amount. Follow E701 back to the preserved source row R2 before reporting completion.
Continue practising: explore the existing Excel Task Hub for additional exercises.