@HansDouwe,
thank you for your help! I've tried to implement this in my real worksheet, but I just get #VALUE...