ty Jakobshavn , that was exactly what i needed. i assume my approach on calculating things was wrong. i just need to find out now how to save this function so its applicable every time i open excel irrespective what file it is.