Number of Paths on a Grid From S to M I was reading about a the derivation of the formula for the number of paths from one corner to another corner of a H by W grid here and I wondered whether it is possible to apply the result: $\binom{(H-1)(W-1)}{H-1}$ to find the number of paths from a given square on the top row of the grid to another selected square in the bottom row.

For example the number of paths from B to J.
I thought of reducing the grid to just the columns B to D, counting the paths there and then adding the possible paths from every other square outside the reduced grid. However I had trouble in finding a formula for the possible paths from outside of the reduced grid.
In a path you cant repeat a square, and you can move to any adjacent square.

In the original source, note that each step in the path was Right or Down.  With those rules, any path from B to J requires 2 Rights and 5 Downs, in any order.  There are $\binom{5+2}{2} = 21$ such paths.  But to go from B to G, say, you would need Left and Down moves.  If you allow Left and Right both, then the number of paths is infinite, as you could move Right Left Right Left... as long as you like.
Edit: With the restriction about not visiting a position more than once, the number of paths with every direction allowed is finite but large (compared to the board size).  For instance, the number of paths between opposite corners of a $2 \times n$ grid is $2^{n-1}$, already exponential.
