View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Herbert Seidenberg Herbert Seidenberg is offline
external usenet poster
 
Posts: 1,180
Default OR in a SUMPRODUCT formula

Here is the general rule for changing AND to OR in Sumproduct
If you want to say: "Look for a row that reads C D" then use
=SUMPRODUCT((Range1="C")*(Range2="D"))
If you want to say: "Look for a row that has C or D in either column"
then use
=SUMPRODUCT(--(NOT((Range1<"C")*(Range2<"D"))))
If you want to say: "Look for either C or D in Range1" then use
=SUMPRODUCT(--(NOT((Range1<"C")*(Range1<"D"))))
So the rule to change from AND to OR is (DeMorgan's theorem):
Change the = to < and negate the whole (put NOT in front)
In your example, change the formula to:
=SUMPRODUCT((Prog="ProgA")*(Org="ProgA")*(Status=" RED")
*NOT((Sens<"C")*(Sens<"D"))*(Plan<"ACTIVE"))