We study Δ(x; ϕ), the error term in the asymptotic formula for [sum ]n[les ]xcn, where the cns are generated by the Rankin–Selberg series. Our main tools are Voronoï-type formulae. First we reduce the evaluation of Δ(x; ϕ) to that of Δ1(x; ϕ), the error term of the weighted sum [sum ]n[les ]x(x−n)cn. Then we prove an upper bound and a sharp mean square formula for Δ1(x; ϕ), by applying the Voronoï formula of Meurman's type. We also prove that an improvement of the error term in the mean square formula would imply an improvement of the upper bound of Δ(x; ϕ). Some other related topics are also discussed.