"40-50 years old" vs. "40-50 year olds" when referring to a group

If you are using it as a compound adjective or noun, as in your example sentence, it should be "40-50-year-olds".

If you are using it as a separate qualifier, as in BillFranke's suggested alternate wording, than it would be "those 40-50 years old".

Confusing, perhaps, but the general rule is that when any sort of counted "thing" is used as an adjective, the object of the count is singular. "40-year-old man", "3-mile run", etc. Making it a range instead of a single number doesn't change that.

But when a number and an object of that number are used "on their own", i.e. not as a compound word, the normal rules of pluralization apply: "those 1 year old", "those 2 years old", etc.