Ravindra BagaleCourses & study guides मराठी Track your progress

17. Interview Questions and Answers

Excel

17.3 Lookups

Explain the key, match policy and return value before choosing a lookup function. In both practice labs, prove what happens when a key is missing or an amount sits exactly on a threshold.

Q21 to Q23. Choose a lookup that matches the key and workbook

Describe the problem in one sentence

Imagine a fictional Amazon-style parcel desk. Someone scans an item code and wants the item's stock quantity. A lookup compares that requested code with a search range and returns an associated value. The requested code is the lookup value. The source field holding all codes is the lookup range. The quantity field supplies the result range. Check that the source has one intended record per code. If the actual source has one row per code and warehouse, a code by itself may identify several records and the question needs another field or an aggregate.

For an item identification question, use an exact match. Excel can look in different parts of the range depending on the function. In ordinary VLOOKUP the key is in the first column of the chosen table array, and a number gives the return column within that array. A value of two means the second column of that specific selected range, regardless of its worksheet letter. FALSE or zero asks for exact matching. Omission leaves approximate matching in effect. For an item code, put the desired match type in the formula so it remains clear to another reviewer.

XLOOKUP takes independent lookup and return ranges and defaults to exact match. The result can be to either side of the source key. A missing-result argument can describe an expected absent code. It can search last to first when the business needs the last qualifying row in a known order. A return range with multiple columns can also return several adjacent values in a supported version. Microsoft explicitly notes that Excel 2016 and 2019 cannot use XLOOKUP as a supported calculation feature. Check the versions of the people who receive the workbook before choosing it.

Show where a positional column number can become unreliable

  • In a practice lookup that starts at B, position one means B. Position two means C. If an unreviewed edit inserts another field between them, a fixed return position two can still return a value while selecting a different field.
  • An exact INDEX with MATCH combination can reference the search column and result column directly. Match type zero asks MATCH for the first exact match and returns its position within the selected search range.
  • INDEX returns the value at that position in the selected result range. If the search range starts one physical row below its result range, the returned value can correspond to a different item. Verify both endpoints and the source key.
  • A named field or well-aligned range makes the intention inspectable. A structural change, missing field or renamed dependency can still affect any formula. Verify the intended value after data layout changes.

A strong interview answer says when each method fits. "I use XLOOKUP if the recipient has a supporting version and I want separate search and return fields. If the workbook goes to an older recipient and the target stands to the left, I can use exact INDEX and MATCH. VLOOKUP with FALSE remains readable in an established workbook whose table has the key in the first selected column. I test one valid key and one missing key." Each part describes a concrete choice and observation.

Recognise that a returned match can still be ambiguous

If two source rows contain the same key, exact matching can succeed and return a value while the report remains underspecified. For example, one fictitious SKU has 14 in Pune and 5 in Nashik. The first match is whichever relevant row appears first under the selected lookup search policy. Neither number is total stock across the two stores, which would be 19. Ask if the report needs one location, the newest confirmed count, every associated record or a total. A reverse lookup can find the last position but the last position is only the latest record when the source order is guaranteed and a tie rule exists.

In an interview sample, build two same-key records with different results. If you choose explicit warehouse and item conditions, verify the matching count before trusting the result. A lookup on a duplicate warehouse-and-item combination might need an effective date or another uniqueness rule. If you choose to aggregate, check whether each quantity uses comparable units. Adding a carton quantity to an item count silently combines different measures.

Q24. Trace both coordinates of a reporting grid

Match the labels before reading the result cell

In an inventory training report whose rows are cities and columns are months, the question "What is the March value for Nashik?" asks for two specific coordinates. MATCH in exact mode finds the position of Nashik in the list of cities, then finds the month header in the ordered header range. INDEX reads the rectangular data result at that row and column position. No division or sum is involved in this lookup. The cell must already contain the intended monthly value.

Nashik is the second city and Mar-2026 the third month. The matrix value at row two and column three is 270.
One exact match selects the row and another selects the column. INDEX returns their intersection from the data grid.

Lab one. Build a two-direction lookup and check exact keys

On a disposable Grid sheet, enter the following A1:D3 fixture. The numbers are fictional dispatch totals. Use the month headers as literal text for this rehearsal. When Excel might auto-convert them, type an apostrophe before each or set Text format before entering. In a real date report you may instead use true first-of-month dates with a month display. In that case match with the corresponding date value, such as DATE(2026,3,1), instead of the text which looks the same.

Two-way lookup source
CityJan-2026Feb-2026Mar-2026
Pune100120150
Nashik80110270
=INDEX(B2:D3,MATCH("Nashik",A2:A3,0),MATCH("Mar-2026",B1:D1,0))
=XLOOKUP("Nashik",A2:A3,XLOOKUP("Mar-2026",B1:D1,B2:D3))
=VLOOKUP("Nashik",A2:D3,4,FALSE)
  1. Enter the INDEX formula in a result area. Confirm the row match returns two and the column match three. These are positions inside the argument lists. They are separate from worksheet row three and column D. The value in D3 is 270.
  2. In a supported Excel version, try the second formula. The inner XLOOKUP chooses the March column containing 150 and 270 as a two-row selection. The outer one selects the Nashik row from that returned set. Confirm the same 270.
  3. The third formula retrieves March by a known return position. Verify that the A:D table array includes the City key and three month values. Column four is March within that exact array. This formula does not separately validate a month header.
  4. In the two-way formula change Mar-2026 to Feb-2026. Nashik gives 110. Change the city to Pune and keep February. The result becomes 120. Confirm both digits come from the correct identity and stored header.
  5. Try Mumbai while keeping February. The exact match for Mumbai cannot find a source city, so the baseline INDEX/MATCH formula produces #N/A. Restore Nashik and check 110 again. In the real report agree how to mark missing coverage while preserving a useful diagnostic.

Predict which input changes each result

  1. Choose Nashik

    Its label occurs at position two in the City list.

  2. Choose March

    Its header occurs at position three in the month list.

  3. Locate the intersection

    Row two and column three within B2:D3 give 270 in D3.

  4. Change the month only

    February gives 110 at the same city position. The exact month match becomes position two.

Try an interview variant in an isolated copy by swapping the February and March columns as whole columns within the fixture. Keep every header attached to its corresponding two values. The exact two-way label selection should still retrieve 270 for Nashik in March once its references target the correctly arranged grid. A newly written VLOOKUP that still asks for position four now picks the value in the column that moved there, February's 110. Spreadsheet edits can also rewrite references, so inspect the actual formula after making the change rather than assuming how an existing formula adjusted.

When your test yields #N/A, inspect the stored month header with an exact type and value check. A label formatted to show Mar-2026 can be a genuine Excel date beneath the format. A hard-coded search string for those characters cannot reliably represent the same key. Compare one header with its intended search input. If the result returns the wrong month's value, inspect the header range and result grid widths and make sure both begin with the same represented month. Restore the original headers and data after the lab so its output stays reproducible.

Q25. Specify whether an approximate match chooses a floor or a ceiling

Turn the original commission bands into a typed lookup table

A fictional delivery fee exercise has a fee of 30 for orders from 0 up to but below 99, a fee of 25 from 99 up to but below 199, a fee of 15 from 199 up to but below 499, and a fee of zero from 499 onward. The table has one row per lower threshold, including the threshold itself. For amount 250, the thresholds 0, 99 and 199 are eligible. The highest is 199, which supplies fee 15. This model is unrelated to any actual delivery company policy.

At amount 98 choose threshold zero and fee 30. At 99 choose threshold 99 and fee 25. At 250 choose 199 and fee 15. At 499 choose 499 and fee zero.
The behavior at exactly 99 and 499 demonstrates what it means for the lower boundary to be inclusive.

Approximate VLOOKUP with TRUE needs its first column sorted ascending for this lookup pattern. It requests a lower eligible match when there is no exact match. An omitted fourth argument invokes approximate behavior, so write TRUE on purpose for a fee table rather than relying on omission. Sort the full threshold and fee records together. A sort on thresholds alone can destroy the pairing. For supported XLOOKUP, match mode minus one asks for exact or next smaller. Match mode one asks for exact or next larger. Binary search modes additionally require the correct sort direction specified by Microsoft. Keep a simple ascending, unique threshold table and use ordinary supported search in this beginner lab.

Lab two. Verify the amount on each side of a band edge

In a separate scratch sheet use A1:B5 for the schedule. A1 is Minimum and B1 is Fee. The four numeric pairs are 0 and 30, 99 and 25, 199 and 15, and 499 and 0. Put the candidate amount in D2. Use the first formula for approximate VLOOKUP and the second if the Excel version supports XLOOKUP. Place them outside the schedule and input. Use a defined missing-base message for XLOOKUP and leave the raw VLOOKUP failure observable on the practice source.

=VLOOKUP(D2,$A$2:$B$5,2,TRUE)
=XLOOKUP(D2,$A$2:$A$5,$B$2:$B$5,"Below first band",-1)
Expected fees from the original ascending schedule
AmountChosen minimumFee
0030
98030
999925
1989925
19919915
25019915
49819915
4994990
  1. Try 250 first and predict a 15 fee. With match mode one in the XLOOKUP variant it would pick 499 as the next larger value and return zero. That difference demonstrates the importance of the chosen rule.
  2. Enter 98 and 99 in turn. Expect 30 and 25. A fee changing exactly at 99 verifies inclusion of the lower endpoint instead of an off-by-one band edge.
  3. Test 198 versus 199 and 498 versus 499. The transitions are 25 to 15 and 15 to zero. Inspect the zero like any other genuine numeric fee. A no-match state should be represented differently.
  4. Set D2 to negative one. It is below every permitted minimum. The raw approximate VLOOKUP returns #N/A and the XLOOKUP variant shows Below first band. If a user accidentally clears D2, distinguish a truly missing amount with a separate input check. Do not equate a blank input with a real numeric zero policy.
  5. Restore D2 to 250 and check the two 15 results. Retain the ascending source and unique thresholds. Do not use a deliberately shuffled fixture to infer which output Excel will pick from an unsupported approximate order. In a review, repair the source order and repeat the boundary cases.

A follow-up can ask for a ceiling instead. If rows are maximum allowable weights, package mass 2.3 might need the first band able to handle at least that mass. This uses an upper eligible limit rather than a lower threshold. Identify the unit, choose the documented match direction and verify values just below and exactly at a limit. Amounts and weights may include decimals. Review a case such as 98.99 between whole thresholds if the source stores decimal amounts. Clean numeric input and consistent units matter more than the visual formatting of the fee column.

Q26. Debug a visible key with a failed exact match

Verify the stored characters and type

Find a specific failing row before changing the column. If an item code appears to say A101, compare the lookup input and source length. An ordinary trailing space yields length five instead of four and can prevent an exact match. If one side stores numeric 101 and the other stores text digits, inspect the type with ISNUMBER. If the key has leading zeroes or a supplier defines it as text, converting both sides to numbers can destroy distinctions. Clean according to the key's owner, and retain the original values in the practice source.

Ordinary case changes by themselves generally do not explain a failed match in these standard lookup examples. VLOOKUP and MATCH in their usual text matching do not distinguish capitalisation. Other characters that look similar, accented letters and unseen spaces are stronger candidates. For an explicitly case-sensitive code policy, use a case-sensitive comparison such as EXACT in a design that intentionally selects the matching row. Verify two differently cased legitimate values so the exercise shows the actual behavior. Regular case-insensitive lookups work well when the key rule itself is case-insensitive.

  • Selected field. Check that VLOOKUP's first selected column really contains the order or item keys. A correct key elsewhere on the sheet is outside its search field.
  • Range endpoint. Check whether the key was added below the last referenced row. An Excel Table can be useful with correctly set range membership. Verify a known new key through the resulting formula.
  • Cleaning policy. TRIM can remove ordinary outer spaces, while a nonbreaking space may require targeted substitution. Identify the character first, and avoid changing significant internal separators without approval.
  • Business coverage. An exact missing result can tell you the master list has no matching record. A review message is useful once you separate that state from a spelling, layout or type problem.

Demonstrate a minimum example in spare cells. Set J2 to the label A101, K2 to 14 and J3 to A102 with K3 equal to 5. Use an exact VLOOKUP from a spare result. With the target input A101 it returns 14. Replace the search input with A101 followed by an ordinary space and it returns #N/A. Check LEN from the input to observe five characters. In a separate helper remove the unexpected outer space and repeat the exact lookup, recovering 14. Keep both the input and helper during review so the change is visible. If the lookup addresses a package serial that allows significant spaces, use the documented key convention instead of assuming TRIM is safe.

If the displayed result returns zero, check the matched source cell as well as the match status. The source may have an actual zero, a blank cell returned as a displayed zero, or an unexpected representation. Use an independently testable "found" check or compare the known returned field. Preserve domain distinctions when zero quantity means no stock yet a blank inventory count means the store has never submitted an update. Let the report explain the matched record and its field state separately.

Q27. Match an exact pair and check uniqueness

Check the combined location and platform before retrieving a store

The original interview question uses fictional platform FreshGo. In this extension each City and Platform pair has one intended Store ID. Imagine someone wants Pune and FreshGo, while there is also a Pune record for QuickCart and a FreshGo store in Nashik. A City-only raw lookup would not distinguish the first two. A Platform-only lookup could choose a store in another city. Create a separate small training Table named tblStores with the columns shown below and use both tests whether you use a helper key or a boolean expression. If another Table in your scratch workbook already uses that name, start a new workbook for this fixture.

Fictional stores with distinct City and Platform pairs
CityPlatformStore ID
NashikFreshGoN-F01
PuneQuickCartP-Q12
PuneFreshGoP-F17
NashikQuickCartN-Q04
=COUNTIFS(tblStores[City],"Pune",tblStores[Platform],"FreshGo")
=XLOOKUP(1,(tblStores[City]="Pune")*(tblStores[Platform]="FreshGo"),tblStores[Store ID],"Review pair")

The multiplication works on corresponding positions. The City test gives FALSE, TRUE, TRUE and FALSE in source order. The Platform test gives TRUE, FALSE, TRUE and FALSE. When the test arrays multiply as numbers, only the third position gives one, from TRUE times TRUE. The rest give zero. XLOOKUP searches for one and returns P-F17 from the corresponding result position. The count is one. Try adding a second Pune and FreshGo store with a different Store ID in an isolated copy. COUNTIFS now returns two, showing that the selection needs a new rule even though the default lookup can still return the first qualifying record.

Explain a helper key without assuming every separator is safe

Some older workbook recipients cannot use the exact same XLOOKUP expression. A helper key column can join the two normalised fields with an unambiguous separator, and an exact version-appropriate lookup can search the helper. For the demonstration use Pune and FreshGo to create the literal key Pune|FreshGo, provided neither source field is allowed to contain the separator. If one field can contain the separator, different input pairs can produce the same combined text. An example is A|B paired with C versus A paired with B|C. Both produce A|B|C. Choose a representation the data contract makes unambiguous or keep the multi-field test explicit.

When there are multiple legitimate stores for a pair, the example's one-store condition no longer holds. A requested list of all such stores may suit FILTER in a version supporting it. A requested count could use COUNTIFS. A request to choose the main store needs a field or approved ordering that indicates which one to choose. Ask a question about the output before introducing an arbitrary last-match rule. A good candidate makes the uncertainty clear and proposes one distinct observable test.

Q28. Use a controlled mapping to make corrections traceable

Demonstrate an exact master join without deleting the raw label

Suppose an approved practice map for a fictional food delivery review contains the normalised source label pune with canonical output Pune. It also contains nashik with output Nashik. Stage a clean matching key using the allowed whitespace and case rules. With raw label " PUNE " the key can become pune. Search exactly, then expose the canonical label in a separate field and retain the raw label in the source. If the label is pun without approval, return Review city or the original failure marker, then reconcile it with a source steward. A workbook can offer a review queue rather than guessing the closest legitimate name.

A mapping Table works when each normalised input key has one agreed output. A duplicate source mapping to two different canonical cities deserves investigation. Removing duplicates by choosing an arbitrary first row can hide a real discrepancy. For example, "market 02" might refer to different sites in different regions; the mapping then needs both site label and region. Before building a lookup formula, check the expected mapping grain and source system. A city rename or legacy label can require a decision about which reporting periods should show a current name. Keep the approved name and date conventions separate from formulas.

If an interviewer asks how you would maintain the mapping, describe a small validation routine. Count accepted and rejected rows after applying the mapping, confirm the known sample belongs to its expected group, and compare original totals before and after the cleanup. Normalising a verified city name should move which label receives a record while preserving the original amount and key. A new city can create a review flag without a failure in the calculation syntax. Provide sufficient evidence to repair the data and repeat the check on an authorised copy.

Keep the lookup accessible to the people who will use it

Suppose an interviewer's laptop supports newer Excel while their colleague keeps a legacy workbook. Discuss who must recalculate the file and which behavior requires a specific function. A separate static export can provide a read-only result when the recipient only needs the authorised output, while an editable workbook needs a formula or workflow compatible with the recipient's environment. Do not treat a visible cached result as proof that changes later recalculate. Have the recipient test a known key and one absent key in a safe copy.

Another follow-up is whether to standardise the returned value as well. An exact match returning a row says the search key qualified according to the formula. It says little about the validity of the price, number or label in that row. Check an amount's type, safe units and effective date. A mapping to an approved label can still point at a retired group if the active status is wrong. State what the lookup verifies, and what data checks need to happen before or after it.

  • Record the original search value, cleaned key and expected canonical result.
  • Compare how many rows should match and how many actually matched.
  • Test a missing code, two similar codes and an intentionally duplicated source pair.
  • Verify the receiving Excel version, then restore or discard your deliberate changes.

Quiz. Find the rule before reading the result

Which number is Nashik in literal March, and what does MATCH return for the city?

The result is 270, and MATCH for Nashik returns position two within the city list. The month returns position three. The two positions refer to the chosen data block, leading to cell D3. The numeric return is the source cell's value.

What happens at amount 499 in the original fee table?

The 499 threshold is included at equality, so the fee becomes genuine numeric zero. An amount 498 still uses the 199 threshold and pays 15. A missing match below all minima is a separate state.

Which match mode chooses 199 for amount 250 in XLOOKUP?

Use exact or next smaller, match mode minus one. Exact or next larger would choose 499 and the reported zero fee. A boundary test should prove the match direction on representative amounts.

Can a source key's worksheet location make it invisible to VLOOKUP?

VLOOKUP searches the first selected column. The desired key can also appear below the current search range. Inspect its physical row and field before attempting to clean the text.

If a two-field XLOOKUP returns P-F17, does that prove the input pair is unique?

Check COUNTIFS or the matching records. The default lookup returns one matching result. If there are two stores for Pune and FreshGo, it can still return P-F17 while the underlying question remains ambiguous.

Does matching 0012 as numeric 12 preserve all identifier meaning?

A fixed-width identifier may require its leading zeroes. Verify the source key standard before conversion. The legacy text code and the numeric value can belong to different records. Preserve raw keys so the normalization choice is reviewable.

Model answers for five follow-ups

How do you choose among the three exact lookup methods?

I check the key location, receiver's Excel version and behavior for missing or duplicate keys. I can use FALSE with a compatible VLOOKUP whose first column holds the lookup key. Exact INDEX with MATCH can read a return field to the left. XLOOKUP expresses separate arrays directly in supporting versions. I verify a known key and a missing one.

How do you explain a two-way lookup without using Excel vocabulary first?

I find which row belongs to Nashik and which column belongs to March. Their intersection shows 270. Then I describe the two MATCH calls for the positions and INDEX for the cell value. Asking for February changes the column only and returns 110.

How do you check an approximate answer?

I state which threshold qualifies and how equality behaves. With the fee schedule I choose the greatest minimum no larger than the amount. At the boundary 199 the fee is 15. At 198 it is 25. I also test the below-minimum response and confirm ascending paired records for approximate VLOOKUP.

What do you inspect when an exact lookup reports #N/A?

I check the role and boundaries of the search range first, then compare stored types and characters. If a helper normalizes a trailing space under the source's rule, I verify its length and lookup behavior. If nothing matches after those checks, I report the missing key under the agreed policy.

When is a mapping table a useful cleaning approach?

I use an authorised mapping for known text variants and keep the original label. I check that each input key has one useful canonical result, review unmatched labels and reconcile their records. I test a deliberate new label to make sure it reaches review rather than a silently guessed category.

Recall cards

  • Search and return

    Identify the requested value, search field and intended associated output before choosing a function.

  • Two positions

    Two exact MATCH operations select a row and column position. INDEX reads their intersection.

  • Approximate floor

    Choose the highest qualifying lower limit and test the amount immediately beside it.

  • Present is not unique

    A lookup can return the first matching result when several valid rows qualify. Check the count and rule.

  • Stored key

    Inspect type, length and source range. Preserve leading zeroes when they define the key.

  • Mapping log

    Keep raw labels and an approved canonical field so later checks can reproduce the correction.

Official references

Extend the first lab with a return field to the left

Use a typed tracking code in an inventory exercise

Imagine the fictional package room has a named label for every code. Use a separate scratch sheet with columns A through C named Product, Units and Code. Add rows Oats, 14, A101 and Rice, 5, A102. Enter A102 in E2 to ask for the product name. The desired output sits in column A and the key column is C. VLOOKUP's usual selected table cannot start at C and directly retrieve A to its left. A separate rearranged or derived array could expose a different layout. The example below works directly on the existing fields.

=INDEX(A2:A3,MATCH(E2,C2:C3,0))
=XLOOKUP(E2,C2:C3,A2:A3,"Review code")
=XLOOKUP(E2,C2:C3,A2:B3,"Review code")
  1. Enter the first formula in F2 and verify Rice. MATCH returns two because A102 is in the second position of C2:C3. INDEX returns the second product from A2:A3. Check that both ranges start at sheet row two.
  2. Use the second formula in another free result cell if supported. It should also return Rice. Change E2 to A101. Both single-result formulas return Oats. The search and return fields remain separate in the formula text.
  3. In a sufficiently open part of the scratch grid try the third formula. For A101 it returns Oats and numeric 14 in two adjacent columns. The formula can return both fields because its aligned result array has two columns. Place it outside a Table and keep destination cells free.
  4. Test input A103. Exact MATCH cannot find the key and the first formula returns #N/A. The second formula returns Review code. The third formula with its not-found text returns that text instead of the pair. Avoid making a second formula assume there will always be exactly two successful returned fields.

Predict a returned first item before trusting an index

Position two is within the range you supplied. It is currently sheet row three, but choosing an input that starts at C5 changes the physical row for position two to row six. If another person had put the Product result range at A3:A4, the same MATCH value two would point to row four instead of Rice at row three. Each array can still have an identical size. Compare their positions with the original key to reveal wrong alignment. A single valid answer on a repetitive dataset can be misleading if nearby rows share the same displayed product.

For the second variant add another row labelled Oats, 40, A101 to a new copy and intentionally include it in both ranges. By default the lookup can return the existing Oats and 14 first. A reversed search can choose Oats and 40. If someone claims the second row is the latest, ask which timestamp or recorded version establishes that ordering. If the goal is total inventory for A101 across two locations, the 54 units need a separate aggregation and verification that the quantities have the same type. If the goal is inventory within one location, add that criterion and check that only one relevant row qualifies.

Read the answer back with the data condition included

The useful evidence from this extension is two lookups that agree for a case with a return field to the left, and a deliberate mismatch in the missing result behavior. Both can show a valid result for a supplied key. The review message concerns an input absent from the source range. It does not prove that the missing product never existed. A range whose last row was left behind after a paste can still miss a real key. Verify Table membership or the explicit endpoint if another team updates the source periodically.

Restore the original two records or discard the extension with the other scratch copies. Keep the accepted answer, one absent case and a short note about whether the workbook needs backward compatibility. In a real handoff, explain whose master list supplies each result and who reviews an unexpected key. It is possible for a formula to work exactly as written and still answer an outdated inventory question.

When comparing lookup formulas, give the key, the match direction and one observed counterexample. Someone else can then test the specific assumption your answer depends on.

Continue practising: explore the existing Excel Task Hub for additional exercises.