View Single Post
  #3   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default

Some people are enamored of using -- to coerce logical arrays to numeric
arrays. IMHO, it obfuscates already complicated formulas like this one.
If you explicitly combine conditions using * for AND and + for OR, the
coercion occurs without all the extra --'s floating around.

=SUMPRODUCT((VALUE(RIGHT(PosDeptNum,2))=$A7)*(
(PosStart<=G$6)*(PosEnd=H$6)*PosHrs/40
+(PosEnd=G$6)*(PosEnd<H$6)*PosHrs/40*(PosEnd-G$6)/(H$6-G$6-1)
+(PosStartG$6)*(PosStart<H$6)*PosHrs/40*(H$6-PosStart)/(H$6-G$6-1)
)

is equivalent to your formula, involves fewer characters, and IMHO is
easier to follow.

Jerry

gpie wrote:

Got it!

=SUMPRODUCT(--(VALUE(RIGHT(PosDeptNum,2))=$A7),--(PosStart<=G$6)*--(PosEnd=H$6)*PosHrs/40+
--(PosEnd=G$6)*--(PosEnd<H$6)*PosHrs/40*(PosEnd-G$6)/(H$6-G$6-1)+--(PosStartG$6)*--(PosStart<H$6)*PosHrs/40*
(H$6-PosStart)/(H$6-G$6-1))