If I understand the problem correctly there isn't a formula because the number of weeks the class doesn't run is arbitrary. However if you have a spreadsheet there may be a way to get around this. That will very much depend on the information in the spreadsheet, and how it's being presented. We'd need to know that before being able to proceed further.
What would probably needed is a sort of "IF" formula that would work along the lines of:
"=IF([class took place that week],1,0)"
This formula will output 1 if the class took place that week, and 0 if it did not. You can then go to the bottom of the column (or end of the row), and enter a formula that would be:
"=SUM([column])"
This would add up all the 1's and 0's together, and the answer would be exactly the number of weeks in which the class took place.
The starting point in this is how you tell excel whether or not the class took place. A cell that simply states "YES" if it happened, and "NO" if it did not, would do, and then the if formula would become:
=IF(C1="YES",1,0)
(assuming you've put the Yes or No in cell C1).
I hope this helps.