What is wrong with the formula that you gave, does it not do what you ask?