I work for a water utility inwhich we have tiered rates based on number of units used. I need to find a formula that will take the total number of unit and split it up based on different tiers. See example:

Total Units Tier 1 Tier 2 Tier 3
(1-14) (15-49) (50+)
________________________________________

78 = 14 35 29

I know there is a way to do this but have been unsuccessful in trying. Thanks in advance.