Thanks for your reply.

What could I use if had like 50 or more different non adjacent cells? Is there a sorter, "simpler" formula?
Thanks.