Does this work for you?

=IF(SUM(C6:F6)<B6,SUM(C6:F6),B6)