This is an approximation for the most part due to rotations and similar.Here's an equation that will do what you need, if I'm understanding what you're asking.
First one:
3^(7-# of oriented corners)*2^(12-# of oriented edges)*(number of permuted corners)!*(number of permuted edges)!/2
Second one:
Take the cube state for the first one and put it in the equation. Then do the same for the second one. Then subtract the second one from the first one.
Example:
F2L-1
3^(7-3)*2^(12-7)*3!*7!/2=39191040
OLL
3^(7-7)*2^(12-12)*4!*8!/2=483840
States between:
39191040-483840=38707200
I may be wrong.