If $|A|=3$ and $|B|=4$, then you have $4^3 = 64$ possible functions from $A$ to $B$. Of those you have $3!\cdot \binom{4}{3} = 24$ injective ones (notice that we use the binomial to choose $3$ elements from $B$, and then we count the permutations of $A$ with the factorial to find the possible different assignments). Since $|B|>|A|$, there are no surjective functions $A\rightarrow B$.
I will show you two ways.
First one is with your current approach and using inclusion-exclusion, so you need to count the number of functions that miss at least $1$ element, lets call it $S_1$ which is equal to ${ 3 \choose 1 }2^5 = 96$. However, notice that this expression overcounts in the case of missing 2 elements. Everytime we count missing 1 and 3 for example, we also count missing 3 and 1 which are the same function. The number of functions that miss $2$ elements, call it $S_2$ is ${3 \choose 2}1^5 = 3$. Now, the total number of surjective functions is $3^5 - 96 + 3 = 150$.
But you can also do the following, fix a surjective function $f$ and consider the sets $f^{-1}(1), f^{-1}(2), f^{-1}(3)$. Because $f$ is surjective, they partition $A$ into $3$ disjoint, non empty sets.
Now think the other way around, start with $A$ and partition it into $3$ disjoint non empty sets, say $A_1, A_2, A_3$, you can then form a surjective function by just assigning one of the $A_i$ to one of the elements in $B$. The number of ways to partition a set of $n$ elements into $k$ disjoint nonempty sets are the Stirling numbers of the second kind, and the number of ways of of assigning the $A_i$ to the elements of $B$ is $k!$ (where $k$ is the size of $B$), in your particular case, this gives $3!S(5,3) = 150$.
The reason I showed you these two ways, is that you can use them to prove the "explicit" formula for the stirling numbers of the second kind, which is $$ k!S(n,k) = \sum_{j=0}^k (-1)^{k-j}{k \choose j} j^n $$
By just double counting, and using a more general inclusion exclusion, and as far as I know, this is one of the most "explicit" formulas you can get.
Best Answer
There is $2^5$ functions. It's a straightforward argument. The number of bijections $\{ 1,2,3,...,n\}\rightarrow\{1,2,3,...,n\}$ are n!. for the first observe the number of this finite sequence: $$\{(1,a_1),(2,a_2),...,(5,a_5)\}$$ which $a_i$ is one of 1 or 2. For the second, we just have the permutations of n element.
Additional info.: When we want to obtain the number of functions from a set $A$ to set $B$, in which $|A|=n$ and $|B|=m$ it's exactly the same, when we want to find the number of all sequences $BOX_1,...,BOX_n$ in which any $BOX_i$ is one of $m$ elements of $B$. yes!the answer obviously is $m.\;\ldots\;.m \qquad(n\; times)$.