again not the tidiest solution but look over what it does, if the concept is correct then I'm sure someone else here on the forums can make this thing work more cleanly. I have only recently started actually writing my own code and still am far from expect. But the below code will tell you the same thing as the formula I gave you. And with modification I'm sure can intelligent figure out the rest...but that is the part where I can't go any further.
To test this out just click on an empty cell on the sample sheet you gave me and it will give you the answer you seek.
Bookmarks