You could do it line by line and look at the last line for your final result. By using two more columns, keep track on each line of the earliest possible date and of the latest possible date.
First line: earliest and latest dates are the ones given for the first person.
Second line: earliest date is the later of the previous earliest date and the earliest date given for the second person. Latest date is the earlier of the previous latest date and the latest date given for the second person.
Third line and up: same technique as second line.
You final range will be in the final line. If the final earliest date is a later date than your final latest date (as is the case in your file), you can conclude that you don't have a range that fits everyone. I would put the conditions in order of importance so that you can go up the list to find a range that fits as many conditions as possible.
This solution won't let you grade the conditions and come up with an optimal solution other than by that kind of absolute sorting. I don't think you'd be able to do that without some programming. It won't let you have several ranges for each line, either. This only works if you have exactly one range for each line or condition or person attending the meeting (to go back to your initial illustration).
I added the columns in your example workbook.
If you ever have to deal with several ranges for each condition, you might have to consider programming, or be brutal:
1) transpose your format so that you have one condition per column
2) assign a row to each possible date.
3) For each column, put a 0 in each date that fits the condition and a 1 in each date that doesn't. I'm not sure how to make a formula do it automatically for more than one range, so at this point, you'd have to actually manually type in the 0s and 1s.
3) sum for each date: dates that fit all conditions will have a sum of 0.
I can set it up for you in your example workbook, but I won't for now: I'd rather not spend the time on it if you don't need it. If you do need it, just ask.
Brigitte
Bookmarks