The balls are distinguishable and for each ball we have three choices of where to put it. The number of possible ways, without restrictions, is thus $3^7=2187$.
The disallowed ways can be counted by inclusion–exclusion. If the balls are put into two boxes we have three choices for which boxes the balls get put into and two choices per ball, leading to $3×2^7=384$ disallowed ways. We counted the $3×1^7=3$ ways to put all balls into one box twice, so we subtract 3.
Finally, the number of allowed assignments of balls to boxes is $2187-384+3=1806$.
You overcounted.
Label the balls $1$ through $6$ and let the boxes be $B_1,B_2,B_3$.
Now suppose that
- In the first step you assign ball $1$ to $B_1$, ball $2$ to $B_2$ and ball $3$ to $B_3$.
- In the second step you assign all remaining balls to $B_1$.
The end result would be the same if you had instead
- In the first step assigned ball $x$ to $B_1$, ball $2$ to $B_2$ and ball $3$ to $B_3$, where $x\in\{4,5,6\}$
- In the second step assigned all remaining balls to $B_1$.
In this particular instance, the same end scenario $(B_1$ with balls $\{1,4,5,6\}$, $B_2$ with ball $2$ and $B_3$ with ball $3)$ was counted four times.
If you are interested in the answer to this problem, notice that it is equivalent to finding all surjective functions $f: \{1,2,3,4,5,6\}\longrightarrow\{1,2,3\}$.
This is answered in the infamous twelvefold way, and the answer is
$$3!\cdot\left\{\begin{array}{c}6\\3\end{array}\right\},$$
where $\left\{\begin{array}{c}n\\k\end{array}\right\}$ is a Stirling number of the second kind, which counts the number of ways to partition a set of $n$ labelled objects into $k$ nonempty unlabelled subsets.
Best Answer
You can do this by inclusion/exclusion. There are $\binom r0r^n$ ways of putting the $n$ balls into the $r$ boxes. From this we have to subtract the $\binom r1(r-1)^n$ ways of putting the $n$ balls into just $r-1$ of the boxes. To this we have to add the $\binom r2(r-2)^n$ ways of putting the $n$ balls into just $r-2$ of the boxes, and so on, so
$$a_n=\sum_{k=0}^r\binom rk(-1)^{r-k}k^n=\left.\left(q\frac{\partial}{\partial q}\right)^n(q-1)^r\right|_{q=1}\;.$$