Explanation
The dropdown is set up with a simple data validation rule based on a "list":
Red,Blue,Green,All
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(F5="all",SUM(qty)
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(color,F5,qty)
SUMIF calculates a conditional sum based on the value in F5 and returns the result.