The formula in excel is =COMBIN(A,B)*COMBIN(C-A,6-B)
A= Winning Numbers
B= 3 (for winning lines of 3 numbers), 4 (for winning lines of 4 numbers) etc.
C= Numbers picked (in your case, 9)
So to find out how many winning lines of 3, when you have 5 numbers up it will be:
=COMBIN(5,3)*COMBIN(9-5,6-3) which becomes
=COMBIN(5,3)*COMBIN(4,3) which equals 40.
I can email the little excel program I've written, if you like.