Create Dynamic Dropdown Lists in LibreOffice Calc
Dynamic dropdown lists in LibreOffice Calc allow the options in a
secondary dropdown menu to automatically change based on the selection
made in a primary dropdown menu. This tutorial provides a
straightforward, step-by-step guide to setting up dependent dropdown
lists using named ranges and the INDIRECT function to
ensure accurate and efficient data entry in your spreadsheets.
Step 1: Organize Your Source Data
- Open a new sheet (e.g., named Data) to store your categories and dependent items.
- In row 1, enter the main category headers across separate columns
(e.g.,
Fruitsin cell A1,Vegetablesin cell B1). - Under each header, list the corresponding items (e.g., list
Apple,Banana,OrangeunderFruits; listCarrot,Broccoli,SpinachunderVegetables).
Step 2: Define Named Ranges
LibreOffice Calc needs named ranges matching the main category names exactly to dynamically link the lists.
- Select the items under your first category (e.g., select
A2:A4forFruits). - Go to Sheet > Named Ranges and
Expressions > Define… (or press
Ctrl + F3). - In the Name field, enter the exact name of the
category header (e.g.,
Fruits). - Click Add, then click OK.
- Repeat this process for each category column, ensuring the named
range matches the header text exactly (avoid spaces; use underscores
like
Root_Vegetablesif necessary).
Step 3: Create the Primary Dropdown List
- Switch to the sheet where you want the user to input data.
- Select the cell where you want the main category dropdown (e.g.,
cell
A2). - Go to Data > Validity… in the top menu.
- In the Criteria tab, set the Allow dropdown to Cell range (or List).
- In the Source box, select the header cells from
your data sheet (e.g.,
Data.$A$1:$B$1). - Click OK. Cell
A2will now display a dropdown with your main categories.
Step 4: Create the Dependent Dynamic Dropdown List
- Select the cell directly adjacent to your primary dropdown (e.g.,
cell
B2). - Go to Data > Validity….
- In the Criteria tab, select Cell range under the Allow field.
- In the Source box, enter the following formula:
INDIRECT(A2)(ReplaceA2with the cell reference of your primary dropdown). - Click OK.
Step 5: Test the Configuration
Select an option from the primary dropdown in cell A2.
Then, click the dropdown in cell B2. The list in
B2 will automatically populate only with the items
associated with the selected category in A2. If you change
the selection in A2, the available choices in
B2 will update dynamically.