Quick, clean, and to the point

Dropdown sum with all option

Excel formula: Dropdown sum with all option
Generic formula 

To enable a dropdown with an "all" option you can use data validation for the dropdown list, and a formula based on IF, SUM, and SUMIF functions to calculate a conditional sum. In the example shown the formula in G5 is:


where "color" (C5:C15) and "qty" (D5:D15) are named ranges.


When F5 is selected, the following dropdown appears:

Dropdown sum with all option in action

When the user makes a selection, the correct sum is returned.


The dropdown is set up with a simple data validation rule based on a "list":


The named ranges "color" (C5:C15) and "qty" (D5:D15) are for convenience only.

The formula in G5 performs a conditional sum based on the current dropdown selection in F5. The outermost function is an IF statement, which checks if the selection is "all":


If so, the formula returns the sum of quantity column as a final result.

If F5 is any value except "all" (i.e. "red", "blue", or "green"), the logical test returns FALSE and IF routes the formula to the SUMIF function:


SUMIF calculates a conditional sum based on the value in F5 and returns the result.

Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.