If the Nz() hierarchy does not get what you want then I guess will need the custom function offered by ranman. Put the function procedure in a general module.