Rodrigo Silva
Rodrigo Silva

Reputation: 387

How to sum the top N values with an OR condition?

I've been using the following formula to sum the top 3 values on a given column with some criteria. color and values are named ranges.

=SUMPRODUCT(LARGE((color="red")*(values),{1,2,3}))

What I couldn't find an answer for is when I want to sum values when color is red OR green.

Is this possible?

Upvotes: 0

Views: 68

Answers (1)

Tim Williams
Tim Williams

Reputation: 166331

One way:

=SUMPRODUCT(LARGE(((color="red")+(color="green"))*(values),{1,2,3}))

Upvotes: 1

Related Questions