Thanks for your code. I think it's working when vTotalYear = 0 is tested true. However, it's possible that there's the field 'Calendar year' doesn't exist. and under that condition, it should go to else statement.. But the code is giving a field not found error. Any idea how to adjust the code?