I have generated two random numbers in different cells between previously specified values. For instance, the first might be 4137 and the second 3982. (The first generate number will always be larger than the second.)

Doing the subtraction "first" - "second" will in this case mean 4137 - 3982. This involves borrowing or trading or exchanging (or whatever name you want). If I generate the first number, how can I tell excel to make sure the second number does *not* involve any borrowing?

Eg. if first number is 4137, then digit 1 of second number can only be 3,2 or 1. Digit 2 of second number can only be 1 or 0. Digit 3 can only be 3,2 or 1. Digit 4 can only be 7,6,5,4,3,2 or 1 (but not 8 or 9).

I figure the solution will need to somehow involve looking at each digit in turn. Is it possible?

Thanks.