if you only want four conditions there's no need for code
if you actually format the cell to a 'default' format you can then use the built in conditional format dialog to apply formats for other scenarios
by way of example, suppose you want to format cells depending on which quartile the value is in:
first set the format you want for a value in the lower quartile range
next use conditinal formatting to apply a format to values greater than the lower quartile and median values
then set formatting for median to upper quartile range
finally set format for values greater than the upper quartile
this may not work in all situations but it's been good for any i've come accross!
however if you need more than 4 conditions or the solution above doesn't work for you then it's down to code and utilising the worksheet change event.
what code do you have so far, if this is the route we need to explore? there are a few limitations and/or complications to this as the change event doesn't fire if the value generated from a formula changes.
;-)