The formula suggested by Wolfgang Moersch is part of the way down this thread:

http://www.apug.org/forums/forum37/3...-any-good.html