Or even simpler (when cc is a data frame), instead of sum(cc[cc[,"a"] <= 5.25 & cc[,"a"] >= 3, "b"]) ## with(cc, sum(b[a <= 5.25 & a >= 3])) Bert Gunter Genentech Nonclinical Statistics