For decades, doctors have prescribed birth-control pills in the hopes of easing women’s menstrual pain, and now a new study finds that it really does serve the purpose: using oral birth control pills helped relieve cramps, bloating and other pain in a 30-year study of Swedish women.

That’s good news for the more than half of all teen girls and young women who suffer from painful periods. About 15% are so severely affected that they regularly miss school or work as a result. In the U.S. alone, this absenteeism is associated with $2 billion in lost productivity.

Despite some previous research and much anecdotal evidence that oral contraceptives help women’s menstrual pain, a 2009 review of the literature conducted by the independent Cochrane Collaboration, which does stringent reviews to help guide evidence-based medical practices, found little evidence that the pill was effective. Researchers could not determine from the existing data whether improvements in pain were due to the pill or simply to the fact that the women were aging — menstrual pain is known to ease with age.

The new study addressed that problem. The research included about 1,400 women living in the Swedish city of Gothenberg who were born in 1962, 1972 or 1982. Researchers surveyed the women first at age 19, then again at 24, with questionnaires about their period pain, use of various types of contraception, whether or not they’d had children, and their height and weight. Only women taking combined oral contraceptives, which contain both estrogen and progestin, were included — not those taking progestin-only pills.

The study found that use of birth-control pills cut women’s pain significantly, reducing it on average one step on a scale of pain — for example, going from severe to moderate — for 1 in 3 women. Women on the pill also needed less pain medication during their periods.

As expected, advancing age was also associated with less pain — but it didn’t make nearly as much difference as the pill did. Giving birth to a child was also linked with relief from painful periods, but the real impact of this factor couldn’t be determined by the study because too few Swedish women had had children at the ages the researchers were studying.

Researchers found that women of younger generations reported more period pain than whose who were born in earlier decades, but they couldn’t be sure whether this might be due to the types of birth-control pills younger women took — perhaps their medications were lower dose — or other factors like a greater willingness to discuss pain.

The study was led by Dr. Ingela Lindh of Gothenberg University and was published in Human Reproduction. Some of the researchers reported previous pharmaceutical industry funding, but the current study was funded by the Swedish government and other non-industry sources.