how can i convert that to custom function Andrew?
.In the case of an Array formula you will need to replace the
ActiveCell.FormulaR1C1 =
with
ActiveCell.FormulaArray =
Jim
Why do you want a custom function when you already have built in functions that do the job?