401K formulas/setup when plan allows different withhold amount on Bonuses?

does anyone have 401k formulas setup to incorporate different amounts withheld on Bonuses.  Our plan allows participates to withhold a different amount on Bonuses both 401k and Roth.  We have formulas setup to calculate 401K and Roth and to compare to one limit but not sure how to add the Bonus 401k and Bonus Roth in?