Let A be a Banach space, \(p>1,\) and \(1/p+1/q=1.\) If a sequence \(\textbf{a}=(a_i)\) in A has a finite p-sum, then the operator \(\Lambda _\textbf{a}:\ell ^q\rightarrow A,\) defined by \(\Lambda _\textbf{a}(\beta )=\sum _{i=1}^\infty \beta _i a_i,\) \(\beta =(\beta _i)\in \ell ^q,\) is compact. We present a characterization of compact operators \(\Lambda :\ell ^q\rightarrow A,\) and prove that \(\Lambda \) is compact if and only if \(\Lambda =\Lambda _\textbf{a},\) for some sequence \(\textbf{a}=(a_i)\) in A with \(\left\{ \left( \phi (a_i) \right) : \phi \in A^*, \Vert \phi \Vert \leqslant 1 \right\} \) being a totally bounded set in \(\ell ^p.\) For a sequence \((T_i)\) of bounded operators on a Hilbert space \(\mathcal {H},\) the corresponding operator \({{\varvec{T}}}:\ell ^q\rightarrow \mathbb {B}(\mathcal {H}),\) defined by \({{\varvec{T}}}(\beta ) = \sum _{i=1}^\infty \beta _i T_i,\) is compact if and only if the set \(\{\langle {{\varvec{T}}}x,x \rangle :\Vert x\Vert =1\}\) is a totally bounded subset of \(\ell ^p,\) where \(\langle {{\varvec{T}}}x,x \rangle = (\langle T_1 x,x \rangle , \langle T_2 x,x \rangle , \dotsc ),\) for \(x\in \mathcal {H}.\) Similar results are established for \(p=1\) and \(p=\infty .\)