I don't know what you're trying to do with that long version of your formula.
Click GO ADVANCED and use the paperclip icon to post up a sample of your actual workbook. Make sure the sample data is clear and manually mockup the answers you're looking for (no formulas there, please, just the answer and explanatory logic if it's not obvious.)
Bookmarks