Try breaking it down like this. The number of lattice paths from A to E avoiding B is the number of all paths from A to E minus the number of paths from A to E that go via B: and this is the number from A to B times the number from B to E.

You need to generalise this usinginclusion-exclusion. You get N(A,E;B,C) = N(A,E) - N(A,B)N(B,E) - N(A,C)N(C,E) + N(A,B)N(B,C)N(C,E) since otherwise the last term would have been counted in twice.