Here's a breakdown:
1. Raw Score: This is simply the number of questions you answered correctly out of the 40 total questions.
2. Scaled Score: The raw score is then converted to a scaled score using a conversion table. This table varies slightly from test to test to account for differences in question difficulty. You cannot calculate the scaled score yourself; ACT provides the conversion after each test administration. You'll find your scaled score on your official score report.
In short, you count your correct answers, but that's only the first step. ACT uses a complex algorithm to translate that number into the final score you see reported. There's no publicly available formula to do this conversion yourself.