Let $P_k(n)$ be the $k$-th largest prime factor of an integer $n\geq1$ if $n$ has at least $k$ prime factors, and let $P_k(n)$ be zero otherwise. An asymptotic formula for the sum $\sum_{n\leq x}P_k(n)$ is obtained.