excelsumifs

SUMIF with multiple criteria and first instance only


I'm trying to sum all of the data in column D that have either a yes in the primary or secondary category, but only include the first instance of that value. In the example below, the sum would be 3 (1 for A, 2 for B). Please help!!

Area    Primary Site    Secondary Site  Value
A        yes              no              1
B        yes              no              2
A        no               yes             1
C        no               no              3

Solution

  • use:

    =SUMPRODUCT(((($B$2:$B$5="yes")+($C$2:$C$5="yes"))*$D$2:$D$5)/((COUNTIFS($A$2:$A$5,$A$2:$A$5,$B$2:$B$5,"yes")+COUNTIFS($A$2:$A$5,$A$2:$A$5,$C$2:$C$5,"yes"))+(($B$2:$B$5="no")*($C$2:$C$5="no"))))
    

    enter image description here