Some expert, who I cant find, published on internet the following masterpiece which has saved me lots of workingtime.

The function works with 2 criteria so I was thinking if someone here with similar experience could tweak it in order to work with 5 criteria.

HTML Code: 
I think that this function will help many of us so if someone could do this I would be very grateful.

Thanks a lot