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

2. Data Entry Tools

Excel

2.5 Dependent Drop-down: City › Area

1. Let the first choice narrow the second list

A college club is making a small delivery roster for event supplies. A volunteer arranging a purchase through a grocery app such as Blinkit recognises the idea of selecting a city or location before looking at suitable nearby options. In the club's practice spreadsheet, Pune should offer Baner, Kothrud and Hinjewadi. Nashik should offer College Road, Panchavati and Satpur. These places are examples for a fictional workflow. The lists do not describe an app's live service areas.

A dependent drop-down makes the second menu depend on the first cell's value. Excel reads the chosen city, finds the appropriate set of areas and uses that set as the Source for the Area list. This prevents the user from scanning choices that are irrelevant to the current request. It also creates a relationship worth checking. If a volunteer changes Pune to Nashik after choosing Baner, the Area menu may offer Nashik choices while the stored Area still says Baner. Keep a separate review for that mismatch.

Three facts per row. The parent cell stores the selected city. The child menu offers areas for that current city. The child cell stores a value until somebody changes or clears it. Verify all three.

Pune maps to Area_Pune, and its choices are Baner, Kothrud and Hinjewadi. Nashik maps to Area_Nashik, and its choices are College Road, Panchavati and Satpur.
Read the parent label, look up the internal range name and then show that range's area choices.

Keep the choice and the rule on the same record

Record one delivery per row, with its own City, Area and any address the coordinator has confirmed. On a sheet named Orders, if City is D2 then Area is E2 for that order. Row 3 should look at D3 to build its list for E3. A training example that only reads a single D2 everywhere works for one dashboard selector and will mislead a person filling many independent order rows. Check two rows with different cities before applying the rule widely.

Explain the intended entry order above the fields or in the Input Message. Ask the volunteer to choose City, then Area, then inspect a row check before handing it to the driver. A dropdown makes valid choices easier to find. It does not by itself verify the address, estimate availability, choose a route or confirm the actual delivery.

Give a missing parent an explicit state

When City has not been entered, the Area dropdown has no normal choices. For this exercise, a fallback source contains Select a city first. This is a visible instruction and not a business area. It could still be selected as text because it is in the fallback list. The independent audit will call it Choose city first or Choose area as appropriate. A production design can use other guidance, such as leaving the child blank and showing a message next to it. Either way, distinguish the instruction from an actual location in the source data.

An unrecognised parent also needs a decision. It can appear if someone pasted a value despite the parent dropdown. The sample allows only three choices. A helper can return a fallback range for blank or unrecognised input. The audit should distinguish an unfinished row from a city name that isn't in the source list. That tells an editor whether to request missing data or correct a supplied field.

2. Use a readable label and a stable list name

Give the workbook a small map

Names defined in Excel cannot contain spaces. The label New Delhi is suitable for display and can map to an internal range name such as Area_Delhi. Don't rely on every city label turning into a valid name after replacing spaces with underscores. Punctuation, near-duplicate labels and potential conflicts make a separate mapping easier to inspect. A new reader can see the exact connection in a source table.

  • Display label. Use the words people recognise, such as Pune, Nashik and New Delhi. Store these same choices in the parent menu.
  • List name. Use a stable, readable identifier such as Area_Pune. Avoid cell-address-like names. Use workbook scope so the Orders sheet can resolve it.
  • Named range. Each internal name refers to the exact area cells for that label. Include available options only, with no title cell or blank tail.
  • Fallback name. Area_Empty points to a single labelled instruction cell for a row that cannot yet show a city-specific list.
  • Audit. Use a separately inspectable list of allowed pairs. When the configuration changes, test both the offered choices and the stored record.

Excel's INDIRECT converts a text value into a usable reference. If a helper says Area_Pune, =INDIRECT(F2) resolves that text to the range defined by Area_Pune. A missing or misspelt name can cause a reference error. Try the helper text before opening the validation dialogue. The named region should select exactly the intended options when you choose it from the Name Box or inspect it in Name Manager.

The helper is small enough to read on every row. It also makes problems diagnosable. If row 2 shows a short key named Area_Pune and row 3 shows Area_Nashik, each is probably pointing at its own source. If the helpers always match row 2, read the reference in the copied helper or Source. If one helper says Area_Empty for a city you expected to support, examine the map and the stored label before changing the other rules.

Check which part of the reference should move

The child validation Source in this lesson is =INDIRECT($F2). The dollar sign fixes the helper column F. The row number can advance. E2 uses F2, E3 uses F3 and so on. $F$2 would tell every child to use the same helper for row 2. A copied side-by-side screenshot with only one city won't expose that mistake. Use a second row with Nashik and read its choices.

Before the lab. If D2 says Pune, D3 says Nashik and both E2 and E3 offer Pune areas, which reference would you inspect first? Explain the difference between fixed column F and a fixed row 2.

3. Lab. Connect three parent labels to independent row menus

Goal. Confirm that a row can choose its own area list without borrowing the selection on the row above. Use a blank workbook with sheets called Options and Orders. Set up the core example in desktop Excel where defined names and custom validation Source can be edited. On other editions, you can keep the same data and audit and verify which menus the workbook supports.

Parent labels and matching internal names in Options A2:B4
City labelList name
PuneArea_Pune
NashikArea_Nashik
New DelhiArea_Delhi
Area values in Options D2:F4
D · PuneE · NashikF · New Delhi
BanerCollege RoadDwarka
KothrudPanchavatiSaket
HinjewadiSatpurRohini

In Options H2 type Select a city first. A1 and B1 can hold descriptive headings, and D1:F1 can label the city columns. Keep heading rows outside the defined lists. Add the following workbook-level names using Formulas > Define Name and verify the exact references. The first two lists are equal in length and their rows correspond. Edit them together if you grow this example.

CityLabels   =Options!$A$2:$A$4
CityKeys     =Options!$B$2:$B$4
Area_Pune    =Options!$D$2:$D$4
Area_Nashik  =Options!$E$2:$E$4
Area_Delhi   =Options!$F$2:$F$4
Area_Empty   =Options!$H$2

Set the parent, look up the key and open the second menu

  1. Create the parent choice

    On Orders put City in D1, Area in E1 and Area list key in F1. Select D2:D7, choose Data Validation > List and use =CityLabels as Source. Enable the in-cell dropdown. Use a Stop alert for unknown direct entry. Try choosing Pune on row 2 and Nashik on row 3. Leave row 4 blank for the fallback test.

  2. Return a real name for the current city

    In F2 compute =IF(D2="","Area_Empty",XLOOKUP(D2,CityLabels,CityKeys,"Area_Empty",0)) in an Excel edition with XLOOKUP. The final argument selects exact matching mode. In Excel 2016 or 2019 use the short IF formula shown below for this three-city sample. Fill through F7. Expect Area_Pune, Area_Nashik and Area_Empty on rows 2, 3 and 4.

  3. Make the child source read its row

    Select the Area target E2:E7 beginning at E2. Under Data Validation > List put =INDIRECT($F2) in Source and enable the drop-down and Stop alert. If the edition makes it easier, test E2 first and carefully copy validation to the other cells, checking the relative reference in E3. When setting up the rule, confirm the current helper holds a valid defined name so the Source can resolve.

  4. Compare two real rows

    Open E2 and expect Baner, Kothrud and Hinjewadi. In E3 expect College Road, Panchavati and Satpur. Set D4 to New Delhi and expect Dwarka, Saket and Rohini in E4. Delete the practice parent from D4 and confirm the fallback menu offers only the instruction. On row 3 try entering Baner as a direct Area value and check that Stop rejects the nonmatching option.

  5. Test the mismatch that cannot fix itself

    Pick Baner in E2 while D2 is Pune. Change D2 to Nashik and check both the stored Area and the current choices. The basic validation does not clear E2 on its own. E2 can still say Baner, while the menu lists Nashik areas. Choose an accurate replacement after checking the real destination. The second lab makes the stale pair visible.

In legacy Excel editions that do not recognise XLOOKUP, use =IF(D2="Pune","Area_Pune",IF(D2="Nashik","Area_Nashik",IF(D2="New Delhi","Area_Delhi","Area_Empty"))) in F2 for the sample. This formula needs an edit if you add a city. It recognises the approved labels through Excel's normal text comparisons, which are usually case-insensitive. The exact audit later is a useful further check. The workbook map lets a modern lookup use a new maintained label without rewriting a set of nested IF branches.

4. Lab. Find stale pairs after copying or editing the parent

Goal. A second volunteer can filter a plain audit column even if their edition shows a different dropdown interface. Duplicate the practice workbook. In Options place City in A8 and Area in B8. Enter the nine allowed pairs in A9:B17. Each row represents a pair and each city can appear on several rows. Use the table above as the source and list each pair once. Start with Pune beside Baner, Pune beside Kothrud and Pune beside Hinjewadi. Repeat for the three Nashik choices and then the three New Delhi choices.

The column lists used by the first lab and the two-column audit table contain the same agreed information in different shapes. Keep both in sync for the two practice runs. A production workbook benefits from one maintained master of allowed pairs when its tools can derive the menus directly from that master. The modern example later demonstrates that arrangement. For the simple named-list setup, have the person editing a city list also verify the pair audit source.

Test stored city and area pairs in a copy
City in DArea in EExpected audit in G
PuneBanerOK
NashikCollege RoadOK
NashikBanerReview pair
New DelhiChoose area
Select a city firstChoose city first
GoaSaketReview city
  1. Keep the audit case separate from the direct-entry test. Use Orders in a duplicate and, if needed, clear its validation from D2:E7 or put these sample inputs in an unvalidated copy of that sheet. The sample intentionally represents all the values that might exist after an import or a parent change. Enter them in D2:E7 in the order shown. Keep the source names and Options references intact.
  2. Count exact pairs on the matching row of the source. Put Review state in G1 and enter the audit formula below into G2. Fill G2 through G7. It checks that the city label and area both appear together on the same source row. An area can be a real place and still be invalid for this city. Matching the two separate columns independently would accept Nashik alongside Baner, which is precisely the error to catch.
  3. Check the different reasons. G2 and G3 show OK. G4 sees a stale pair. G5 asks for an area, while G6 asks for a city. G7 specifically asks for the unrecognised city to be reviewed. Use a filter on these labels. A participant can check the exact pair even when conditional highlighting is not visible on their device.
  4. Repair a pair only after reading its source. Suppose the order represented by row 4 was confirmed for Nashik and its correct area is College Road. Replace E4 with the correct item after confirmation. G4 becomes OK. If the order belonged to Pune, another real decision would be required. The audit is a reason to check, not a direction to overwrite one specific field.
  5. Check the map itself. On a copy replace the final valid pair in Options with another copy of Pune and Baner. G2 now says Review pair even though its own cells remain unchanged. The sample expects exactly one match, so a duplicate in the source is also a configuration problem. Restore the valid final pair and confirm the result returns to OK.
=IF(D2="",IF(OR(E2="",E2="Select a city first"),"Choose city first","Review city"),IF(SUMPRODUCT(--EXACT(D2,CityLabels))<>1,"Review city",IF(OR(E2="",E2="Select a city first"),"Choose area",IF(SUMPRODUCT(--EXACT(D2,Options!$A$9:$A$17),--EXACT(E2,Options!$B$9:$B$17))=1,"OK","Review pair"))))

Read the pair audit from top to bottom

When the parent is empty, the default result is Choose city first as long as the child is empty or holds the instruction. A real area with no city is suspicious, so the audit says Review city. Next the audit counts exactly matching city labels in CityLabels. If there is no exact matching label or the approved label is duplicated, show Review city. Comparing case exactly makes the canonical input visible. This is stricter than the ordinary text matching used in the legacy key formula.

For a known city and an empty child or placeholder, the result is Choose area. For a known city and a supplied area, the last SUMPRODUCT checks both conditions for each source row. EXACT gives TRUE or FALSE. The two minus signs convert these Boolean results to 1 and 0. If both conditions are true on a pair, multiplying the two ones contributes 1. If either side fails, that pair contributes 0. The sum should be exactly one for the allowed pair. The fixed dollar signs keep the source address still as the formula moves down the target rows.

For a smaller example, write the first two allowed rows on paper. If the current input is Pune and Kothrud, the city check is true on each Pune row. The area check is true on the Kothrud row only. Multiply or cross off the other cases. A single matching pair remains. The spreadsheet applies that operation to all the source rows in one expression. Using a fixed range also means new master rows need the reference updated deliberately or replaced with a correctly set up Table reference.

The stored pair Pune and Baner starts valid. Changing City to Nashik changes the menu but leaves Baner stored. The audit says Review pair.
Changing the parent changes the list. Verify the older choice that is still in the child cell.

5. Use a single pair table where dynamic formula support is available

Start with a down-to-earth selection test

In current Excel editions that support FILTER and dynamic arrays, the pair table can provide all areas for one selected city without naming a separate area range for each city. Try this in a copy outside an Excel Table. Put the following formula in Orders J2. Ensure there are enough empty cells to its right. For this test, select Nashik in Orders D2. The formula should present its three areas in one horizontal row beginning J2.

=TRANSPOSE(FILTER(Options!$B$9:$B$17,EXACT(Options!$A$9:$A$17,D2),"Select a city first"))

FILTER tests each row for the chosen city and returns the matching areas. The last argument provides our instruction if none match. Excel otherwise does not produce an empty spill when a filter selects no rows. TRANSPOSE turns the column output into a row. That choice makes it possible to use a separate horizontal spill for each independent order in copies of the example. An obstructing value can cause #SPILL!. Read the intended output area before moving an unrelated input.

In a desktop build that accepts spilled references in Data Validation Source, try =$J2# in the Area validation for E2. The hash refers to the full spill starting at J2. Keep the spill on the same sheet for this simple test. If direct spill references are not accepted by your version, the named-range example is the documented fallback path to try. For a single selector, a workbook name pointing to a supported spill reference can also be tested in your desktop build before relying on it.

For the row-by-row exercise, copy the FILTER formula down the helper column so each row has its own result. Test J3 from D3 and see how the results differ. Verify E3's source refers to the J3 spill and E2 still uses J2. A single vertical spill under J2 driven by D2 can be fine for one dashboard. It is unsuitable when multiple orders need different menus at the same time. The place where each list spills and the address each child references are separate design choices.

Choose the design the workbook's owners can maintain

If the team uses Excel 2016 or 2019, an XLOOKUP or FILTER example authored in a newer build will not provide the same workflow. Use the compatible named-range method for a small, stable workbook. Microsoft describes INDIRECT as volatile. A worksheet formula using many such references can recalculate repeatedly and affect performance at scale. Keep the sample small and avoid claiming you have measured its speed on another team's workbook. A shared users-and-deliveries project might need a real data entry form and a maintained catalogue behind it.

A master pair table is usually easier to inspect than a collection of unrelated lists. Give each approved combination its own row and avoid duplicates. Add a unique key or confirm whether a repeated city label from different origins means the same region. Review any removal carefully. A recorded delivery that was valid last month may need to remain visible even if an area disappears from the current menu. Use the current policy for new choices and give historical records an appropriate review or reporting path.

6. Troubleshoot using two rows and one intentionally wrong pair

  • Wrong menu with a correct City. Inspect the row's key, then the named region or spill address and its actual values. Verify the city-label and list-key rows stay aligned after sorting.
  • Missing or broken list. Inspect the defined name's scope and reference. An extra character or a deleted range can prevent a name from resolving. Test INDIRECT in a spare worksheet cell to reveal a reference problem.
  • Every row offers the same choices. Check for a locked parent row or a single shared helper. Compare a Pune row and a Nashik row that should produce different menus.
  • Stored Area disagrees with the menu. Use the pair audit. Decide the correct area from the actual record. Changing the parent list or formula did not automatically clear the stored value.
  • New area is absent. Inspect whether it appears inside the defined list or master pair table's actual boundaries. Verify that the audit sees the new pair as well.

Volunteers should be able to identify the error message and the source of approved choices without scrolling through formulas. Leave a note in the sheet about the entry order. Add a clear Review pair column close to the inputs. Conditional Formatting can make that word easier to see. It should apply to the same row and leave the explicit message available. Before replacing multiple records, check that the workbook keeps a useful history of the original entries.

Rehearse a catalogue change without breaking the two existing orders

Suppose the club adds a partner fulfilment desk in a fourth city. The example values below are deliberately fixed so you can predict every test. Start from an unmodified copy of the original three-city workbook. The new display label is Kolhapur, its key is Area_Kolhapur, and the three listed places are Rajarampuri, Tarabai Park and Shahupuri. Add the city and its key to Options A5:B5, and put the three areas in Options G2:G4. These are approved combinations for the imagined club, not a current coverage map.

  1. Expand the parent definitions together. CityLabels should now point to Options A2:A5 and CityKeys to Options B2:B5. They must grow in step because each lookup finds a position in the first list and returns the value at that position in the second.
  2. Define the new list's contents. Add a workbook-level Area_Kolhapur pointing to Options G2:G4. Inspect the name itself and click through the actual cells it selects. The key in B5 has to match the real defined name.
  3. Update the audit source and, if used, the filter source. Append the three new city and area pairs in Options A18:B20. Adjust both source ranges in the audit from rows 9 through 17 to rows 9 through 20, then propagate the amended check through the entry rows. Update the FILTER helper ranges together too if you built that demonstration.
  4. Test the new and prior behavior. Select Kolhapur on one spare order row. Its menu should show just its three areas. Choose Tarabai Park and check for OK. Recheck Pune with Baner and Nashik with College Road. Both should still yield valid pairs and their distinct menus.

If you installed the legacy three-city IF helper, add a specific branch for Kolhapur or use a mapped lookup method available on your edition. Changing the city source list alone does not deploy that new branch. A correctly typed city can appear in the parent dropdown while its child still falls back to the instruction. That is a useful diagnostic. It means the constraint is incomplete between the offered label and the child list; it does not tell you that the user made a typing mistake.

Make the before-and-after comparison small. List what the three original choices looked like for each of two known rows, then write a third line for the new city. After the change, prove that each expected menu shows exactly the new or original rows. If a person accidentally puts Tarabai Park in the Pune list while the audit associates it with Kolhapur, the menu and pair audit will disagree. Read both definitions, restore the correct list and retest the actual stored pair in a workbook copy.

Keep lists independent even when their labels overlap

A logistics spreadsheet could use Main gate as a valid location in two cities. That does not mean a dropdown should be fed by every row containing the words Main gate. The city and area together carry the meaning. An address sheet might also require an exact location code or a specific pickup time. The pair audit ensures the workbook's permitted relationship. It does not promise the real parcel belongs to that location. Keep a confirmed address or selection key where the volunteer needs proof.

In a practice sheet you can demonstrate this by adding the label Campus main gate to two separate cities' approved lists. Track each city and its gate as a distinct source row. The exact pair audit returns OK for each intended pair, because each comparison counts only the same city and area on one row. A rule that forbids duplicate area text throughout the entire catalogue would reject the second legitimate label. A rule that checks only for globally valid area text could accept a location for a third city incorrectly. Choose the fields that define identity together.

Handle an exception consistently from selection through export

For an operational hand-off, ask the next volunteer to filter rows where the audit says OK. A user might be able to choose Select a city first from a fallback menu and never open it again. The row is useful in a drafting queue, but it should not become a route instruction. Keep a status such as Pending address until the city and area have both been confirmed. A separately audited export can exclude unresolved rows and show how many were held for review.

If a request can change after the driver sees a printout, schedule a refresh of the dispatch summary or label each issued copy with its approval time. Make it clear where a changed source should be entered. Do not tell someone to force a stale child through Stop because a previous printout said it was valid. The current row must agree with the source and have a coherent review record. In Excel, a displayed list is a convenience for entry and the hand-off should preserve what was approved.

Choose workbook scope and test a copied sheet

Rename one duplicate as Orders practice and look at its source references. A workbook-level name can be used from both the original and duplicate. A local name exists in the context of one sheet and can complicate a lookup if it has the same spelling as a workbook-level name. Keep one intentional scope for each name in this exercise and inspect it in Name Manager. If two names look alike, make the test explicit by selecting the intended sheet and examining the reference each one resolves.

Do the same check for the third and last target rows. A formula using the original Orders D2 by an absolute external-to-row reference may show a perfect first result on the duplicate, then ignore new selections. Click D3 and choose a different city. Read its helper, open its dropdown and inspect its audit. That three-step check proves which source the test row actually uses, and exposes the problem before the copied sheet is sent to a new venue.

Trace a failure with one original and one known-good row

Suppose a Nashik row shows the instruction even though its city appears correct and the Pune row works. Read the stored city and compare it with the exact bytes or characters of the expected label when needed. A trailing space from an import can be hard to see. Test =EXACT(D3,"Nashik") and read the length in a spare cell. Then inspect the key formula in F3. An exact-looking stored label with the wrong key points to the map or reference, while a mismatched label itself points to the incoming record.

If both helper cells show different correct keys but both child menus still show Pune, the City fields and mapping did their jobs. Read the exact Source on E2 and E3 to locate the shared reference. If just E3 has an error, test its named source in one spare cell. A different error path is a newly added key that points to the correct name but the selected name refers to an older list. Inspect the actual addresses. Each step gives you a smaller part of the worksheet to fix.

After repairing a source, restore the source copy if your test changed a legitimate record. Have a teammate reproduce the two working rows and the intentional stale pair using disposable edits. Their result verifies that the worksheet communicates the required combination and still identifies the exception.

Put the expected amount of work beside the review filter. If this six-row sample reports two OK records, four need another action. Counting only Review pair would miss an unknown city and two unfinished selections, so choose a filter that fits the hand-off decision.

Continue with practice in the existing Excel Task Hub. Read each prompt's own catalogue or input pattern. The example here uses a deliberately small group of cities and a fixed pair table.

7. Interview questions with practical answers

How does a dependent dropdown differ from a normal validation list?

The choice available in the child depends on a parent field on the same row. Two rows can have different lists even though their setups use the same pattern. I would verify both the child Source and the stored child value.

How do you support display labels with spaces?

Use a mapping from the human-readable label to a valid defined name. New Delhi can point to Area_Delhi. An explicit map is easier to inspect than deriving a name directly from every possible label.

What should happen when a selected city changes?

The available areas should change. An old area may remain in the cell, so an audit should flag the stale pair for the row owner. Confirm the true location before replacing it.

What causes the second order row to show the first row's area menu?

A fixed row reference or one helper driven by row 2 can cause this. If E2 reads F2 and E3 should read F3, fix the helper column while leaving the row relative, then test two different cities.

Why check pairs instead of validating each city and area separately?

A city and an area can both appear somewhere in the workbook without being a valid combination. Accept a row only when both exact labels are found together in the same approved source record.

8. Predict the next choice and the stored record

  1. What should the helper return for New Delhi in the lab?

    Answer and reasoning

    Area_Delhi. That is the actual workbook name on the same mapping row as the display label. INDIRECT follows that name to the source cells.

  2. Why does E3 read F3 if the E2 validation starts from a reference to dollar F followed by 2?

    Answer and reasoning

    The column is fixed and the row is relative. A copy or application to the next row should advance the row component. Inspect the second target to confirm.

  3. What does the audit return for Nashik and Baner?

    Answer and reasoning

    Review pair. Both labels can be valid individually, but the approved practice table pairs Baner with Pune.

  4. What happens if you change the parent from Pune to Nashik and never edit the old child?

    Answer and reasoning

    The available choices can update to Nashik while the older stored Baner remains. A separate check can mark the mismatch.

  5. Why leave the cells to the right of the FILTER helper empty?

    Answer and reasoning

    The formula returns multiple cells side by side. It needs that space to spill. An obstruction can stop it from returning the menu's intended source.

9. Six checks worth remembering

  • City first

    Use the parent choice to build the second list on the same row.

  • Use a readable map

    Separate the shown location name from the internal range identifier.

  • Fix the column and move the row

    A row-relative helper reference gives each delivery its own choices.

  • A changed menu does not clear a stored choice

    Review stale child values after changing a parent.

  • Test the exact combination

    The approved city and area belong on the same source row.

  • Verify the next added row

    Inspect the source extent, the target's rule and its audit formula.

Microsoft references