Thanks Bob - very close! You're right, it would be interesting to vary the tests in the way you suggest, and also to try out other mathematical functions that could replace CASE statements or stting functions (for example using the LOG function to count the number of digits in a number). I think I might leave that to somebody who's interested and who has time on their hands, though.
John