Whats wrong with the formula you have there?
can you show some samples where it doesnt work?