Alastair and Tsjallie - Thanks for the quick(!) solutions to my problem. Alastair, the sample table you populated with your solution works well, but I agree with you that Tsjallie's code is an improvement. ...except, Tsjallie, when I paste your code into the sheet Excel displays the dreaded 'formula you typed contains an error' message.' - Jim