The potential problem I see with trying to automate the numbering is that it would go askew if your records ever get re-ordered. For example, the second instance of Pharmacology could end up higher in the record list than the first one, meaning that the formula would cause their numbers to reverse, throwing off the reliability of the system (assuming that you want the question that ends up labeled as “Pharmacology 1” to stay that way permanently).
Believe me, I can see the benefit of having them be automatically numbered. That way you wouldn’t have to search through the list to figure out where you’re at in the numbering scheme with each subject. I just can’t think of a way to do it that would still work in the event that the record order ever shifted.