Attached I have a spread sheet of 99 rows, or events, that have start and end times (all in military time).
Let me try to very carefully explain what I would like to do. The events are already listed from smallest amount of time from start to end to largest amount of time from start to end (or should be, I'm actually currently a total excel amateur). The first event is in row 2. I would like to take the difference in time from row 2's starting time with EACH AND EVERY other rows' starting times. Then I would like to take the difference in time from row 2's ending time with EACH AND EVERY other rows' ending times. Then row 3's differences would be added/summed together, then row 4's, and so on to row 100. I would then like the row with the smallest sum to be the next event after row 2. Then I want to repeat the process, so now we have row 2 and 3 established, so row 4 is now "compared" (or has the formula described above applied) to all rows except row 2 and 3. Then row 5 to all rows but 2, 3, and 4.
That explanation might simply not be clear enough, so let me illustrate what I'd like to do with rows 2-99 but acting as if we only have rows 4, 6, 7, and 9 as the complete list of start and end times.
row 4-5:05 to 9:15
row 6-4:40 to 9:25
row 7-5:15-10:05
row 9-4:50-9:45
so row 4, like row 2 is listed first because it encompasses the least overall amount of time from start to end. so to decipher which row should be "ordered" next we do this:
comparing rows 4 and 6: difference between starting times is 25 minutes, difference between ending times is 10 minutes, sum is 35 minutes
comparing rows 4 and 7: difference between starting times is 10 minutes, difference between ending times is 50 minutes, so sum is 60 minutes
comparing rows 4 and 9: difference between starting times is 15 minutes, difference between ending times is 30 minutes, so sum is 45 minutes
row 6 has the least sum of 35 minutes so it would be ordered next. so now we have row 4 and 6 ordered.
comparing rows 6 and 7: difference between starting times is 35 minutes, difference between ending times is 40 minutes, so sum is 75 minutes
comparing rows 6 and 9: difference between starting times is 10 minutes, difference between ending times is 20 minutes, so sum is 30 minutes
row 9 has the least sum so it would be ordered next. so we end up with ordered rows of 4,6,9,7.
to try and describe it conceptually, i want the events listed from smallest amount of time to largest, but I want the start and end times from row to row to be as close to each other as possible.
if anyone could help me on this it'd be greatly appreciated, doing this by hand would take some time. also, if someone could explain "how" to implement the formula in excel that'd be great as i haven't yet used formulas in excel, i've just used it for entering data. but even with the right code i think i can figure out the basics of applying the formula.
thanks.
Bookmarks