.... Where X is C2, Y is B2 and Z is A2 in your original question.
Try the folowing in D2:
Suppose A2 is 56 and B2 is 5. I wrote the formula above so that you
can put 0 through 5 (B2) into C2 through C7, and copy the formula down
through D7. Then, as a check, SUM(D2:D7) should equal the total
number of ways to choose 5 from 56, namely COMBIN(A2,B2).
Explanation: In a set of B2, COMBIN(B2,C2) is the number of ways to
match C2. Then, COMBIN(A2-B2,B2-C2) is the number of ways that the
remainder of the set, B2-C2, does not match any of the B2 numbers
drawn; that is, matches the remainder of the set drawn from, A2-B2.
Computational note: Mathematically, COMBIN(n,k) is computed by
FACT(n)/(FACT(k)*FACT(n-k)). Since Excel uses binary floating-point
to represent numbers and to do computation, Excel can represent only
integers up to 2^53 exactly. Thus, obstensibly, FACT(17) is the
largest factorial that we can be sure is calculated accurately. In
fact, larger factorials can be calculated accurately, by coincidence.
And there are ways to compute COMBIN so as to extend the range of
But the point is: for some combination of A2 and B2, the sum of the
formula above (D2) might not exactly equal COMBIN(A2,B2).