How to Use a Drop-Down List to Select Different Formulas in Excel
Question details
The user wants to dynamically switch between different calculation formulas based on a measurement type selected from a drop-down list, and use those results for cost calculations without encountering errors caused by text units.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating area, volume, or distance dynamically based on a drop-down selection, and subsequently multiplying the result by a cost rate.
- Observed behavior
- When attempting to multiply a dynamically calculated result that contains text units (like "Ha" or "m3") by a cost rate, a #VALUE! error occurs.
Ensure you have already created your drop-down list using Data Validation and that your raw data (like length, width, or base units) is cleanly formatted in separate cells.
Use the SWITCH Function to Change Formulas Based on Selection
The SWITCH function evaluates the value selected in your drop-down list and executes a specific formula corresponding to that measurement type.
The SWITCH function compares one value (your drop-down cell) against a list of options and returns the result corresponding to the first match. This is much cleaner than using multiple nested IF statements.
Click on the cell where you want the dynamic calculation result to appear.
Type your SWITCH formula. For example: =SWITCH(A2, "Hectares", B2*C2/10000 & " Ha", "m3", 2800*8*150/1000 & " m3", "Kilometers", B2/1000 & " km"). In this example, A2 is the cell containing your drop-down list.
Press Enter to apply the formula. Change the selection in your drop-down list to verify that the calculation and the appended units update automatically.

Extract Numeric Values for Cost Calculations
If your formula appends text units to the result, multiplying it directly by a cost rate will cause a #VALUE! error. You must extract the number first.
Create Dynamic Drop-Downs and Formulas with WPS Spreadsheet
WPS Spreadsheet fully supports advanced logical functions like SWITCH, LEFT, and FIND, making it easy to build dynamic calculators and interactive dashboards. It is highly compatible with Microsoft Excel formulas.
- 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your data.
- 2. Create a drop-down list: Go to the Data tab and click 'Validation' to create your measurement-type drop-down list.
- 3. Apply dynamic formulas: Use the SWITCH function to link different mathematical calculations to your drop-down options.
- 4. Format units seamlessly: Select your result cell, press Ctrl+1, and use Custom Format to display units without converting numbers to text.

Frequently Asked Questions
Why do I get a #VALUE! error when multiplying my drop-down result?
This happens if your formula result includes text (like 'Ha' or 'km'). Spreadsheet software cannot multiply text by a number. You must either extract the number using functions like LEFT and FIND, or use Custom Number Formatting to display units while keeping the underlying value numeric.
Can I use the IF function instead of SWITCH for a drop-down list?
Yes, you can use nested IF statements (e.g., =IF(A2="Hectares", formula1, IF(A2="m3", formula2, formula3))). However, the SWITCH function is generally much easier to read, write, and manage when you have multiple conditions.
How do I add units to a cell without changing it to text?
Select the cell, press Ctrl+1 to open the Format Cells dialog, go to the Custom category, and enter a format like 0.00 "Ha". This displays the unit visually but keeps the cell value as a number, allowing you to use it directly in math calculations without extraction formulas.




