After a lot of searching, I have finally found out the formula, the immigration department case officers use, to calculate whether a student has studied for two years or not.
Here is the formula.
T=L X C/U , where:
T= Duration for which the student studied the course
L= length of course on CRICOS
C = number of units completed by student, excluding exemptions
U = number of units which would be necessary to complete the studies
Hope this helps all those who are not clear about the two year study rule.