Thanks! Will check out those functions. Of course the brute force way would be to subtract out the non-masked values, etc…
I did it through several repeat operations – probably not the most efficient but it’s correct and easy to follow. Will rewrite it better as needed. Useful function.