I'm sure I wrote this yesterday but cant find the thread...might be going crazy

Does anyone have a formula to use on excel to calcluate the lexicographical (Don't know if spelt correctly) order of a set of numbers?

ie what is the lex order for number;

1,2,19,22,30,36 based on 6 balls from a pool of 40?

ie if 1,2,3,4,5,6 is 1 and 35,36,37,38,39,40 is 3,838,380.

Any help appreciated.

Thank you,

Irvin