How many ways to pick $X$ balls Suppose i have $3$ types of balls $A,B$ and $C$ and there are $n_a, n_b,$ and $n_c$ copies of these balls. Now i want to select $x$ balls from these $3$ types of balls $x < n_a + n_b + n_c$. Can anybody help me to arrive at the closed formula for this.
I thought, if I partition $x$ into $3$ partition it will do but in that case its quite possible that i can pick more ball of particular type than its actual count.

I am having the same question and looking for a solution which scales largely and it was not clear to me how the other answers here are closed or how I can implement them for arbitrarily large problems.
Here is a non-closed solution, just to document my own progress on this problem:

There are $\{b_1, b_2, \ldots, b_n\}$ copies of the balls.
We are selecting $x$ balls.
The trivial solution:
$$f(x, \{b_1\})=\begin{cases}1,&x<=b_1\\0,&x>b_1\end{cases}$$
The recursive part:
$$f(x, \{b_1, b_2, \ldots, b_n\}) = \sum_{i=0}^{b_1}f(x-i,\{b_2, \ldots, b_n\})$$
