Charlotte Feldman
Charlotte Feldman

Reputation: 1

Sum values based on first occurrence of other column using excel formula and criteria

There have been answers previously explaining how to SUM only the first instance. E.g.

=SUMPRODUCT( (A2:A25<>"") / COUNTIF(A2:A25,A2:A25&""),D2:D25)

When looking to only SUM the values in D on the first instance of a label in A. How would you add a criteria to this formula? i.e. In C the values must equal to "yes"?

Upvotes: 0

Views: 147

Answers (2)

Scott Craner
Scott Craner

Reputation: 152505

Use COUNTIFS with a changing range to see if it is the first then use SUMIFS:

=IF(COUNTIFS($A$1:A2,A2)=1,SUMIFS(D:D,C:C,"yes",A:A,A2),"")

enter image description here

Upvotes: 1

EDS
EDS

Reputation: 2195

You can use SUMIFS.

For example: =SUMIFS($D$2:$D$25, $C$2:$C$25, "yes", $A$2:$A$25, "<>"&"")

Upvotes: 0

Related Questions