In D1 of the attached find This returns the number of unique combinations of 4 of 10 digits. In E1 this formula validates the count yielded by this solution.
Define unique combinations using binary values where each of the digits is expected. IE 1s where the digits are desired and 0s where not. This is done by first determining the smallest decimal value defined by the binary value 1111000000 (unique combination of G1:P1 "0123") and the largest decimal value defined by the binary value 0000001111 (unique combination of G1:P1 "6789"). Those formulas are in B1 and C1 and respectively.
You will need to test all values from 15 to 960 (all 946 numbers) to find those 210 the COMBIN formula indicates. See A2:A947.
In B2:B947 determine which of those decimal numbers' binary equivalent consists of 4 1s only. This formula does that. It is the basis of José's solution (compacted somewhat).
In G2:P947 this "translates" those unique combinations of 4 1s to the corresponding digits in G1:P1
In Q2:Q947 this concatenates those digits into their unique combinations ... all 210 of them.
Let me know if you have any questions.
Bookmarks