We're better able to advise on the algorithm if we know exactly how your end result is calculated. Hence my question seeking to know which cells contribute to your result. It may well be that you don't need a macro or UDF at all. Often standard functions combined in a complex formula are sufficient.