I have a google sheet with 5 Tabs, 1 being the master calendar and 2-5 being individual class calendars.
They each look like this:
| Class | Type | Name | Date Open | Time Open | Date Due | Time Due |
|---|---|---|---|---|---|---|
| TMA | Reading | Introduction | Jan 9 | 11:59 PM | ||
| TMA | Reading | Ch.1 | Jan 12 | 11:59 PM | ||
| TMA | Essay | Essay 1 | Jan 10 | 8:00 AM | Jan 11 | 11:59 PM |
| TMA | Essay | Essay 2 | Jan 14 | 8:00 AM | Jan 15 | 11:59 PM |
| TMA | Exam | Midterm | Jan 12 | 9:00 AM | Jan 13 | 11:59 PM |
How would I make the master document sort all classes by Date Open, then Time Open, then Date Due, then Time Due, with ones that have no Time Due in the front, but if Date Open is blank, then sort by Date Due, then Time Due, with ones that have no Time Due in the front. I'll provide and If else statement:
If Date Open != empty (sort by Date Open, then Time Open, then Date Due, then Time Due, and if there's no Time Due, put at front of that Day)
Else (sort by Date Due, then Time Due, and if there's no Time Due, put at front of that Day)
I would want the Master Calendar to look Like
| Class | Type | Name | Date Open | Time Open | Date Due | Time Due |
|---|---|---|---|---|---|---|
| TMA | Reading | Introduction | Jan 9 | 11:59 PM | ||
| WRTG | Exam | Syllabus Exam | Jan 10 | 8:00 AM | Jan 11 | 4:00 PM |
| TMA | Essay | Essay 1 | Jan 10 | 8:00 AM | Jan 11 | 11:59 PM |
| TMA | Exam | Midterm | Jan 12 | 9:00 AM | Jan 13 | 11:59 PM |
| SOC | Class | No Class | Jan 12 | |||
| WRTG | Reading | OP ED | Jan 12 | 4:00 PM | ||
| TMA | Reading | Ch.1 | Jan 12 | 11:59 PM | ||
| TMA | Essay | Essay 2 | Jan 14 | 8:00 AM | Jan 15 | 11:59 PM |
I have tried the built-in Sort and Range buttons at the top, but they don't allow for conditional sorting.
I have no idea what I'm doing when it comes to the scripting part of it, I think that's what its called, but what I have tried is.
EDIT:I've gotten
=SORT({'REL C 200'!A2:G49;'TMA 140'!A2:G32;'TMA 367'!A2:G151;'SOC 111'!A2:G64}, IFNA(4, 6), TRUE)
=SORT({'REL C 200'!A2:G49;'TMA 140'!A2:G32;'TMA 367'!A2:G151;'SOC 111'!A2:G64}, IF(ISBLANK(D), 6, 4), TRUE, IF(ISBLANK(D), 7, 5), TRUE)
Which both sort everything that has Date Open by its Date Open, but the rest are just shoved in in order of which tab came first.
I also tried
=SORT({'REL C 200'!A2:G49;'TMA 140'!A2:G32;'TMA 367'!A2:G151;'SOC 111'!A2:G64}, IF(ISBLANK(D2), 6, 4), TRUE)
Which sometimes kinda works? It either throws a "circular dependency detected" or it sorts by the Date Due
Then I tried
=SORT({'REL C 200'!A2:G49;'TMA 140'!A2:G32;'TMA 367'!A2:G151;'SOC 111'!A2:G64}, SWITCH(D2:D293, NOT(ISBLANK(D$2)), 4, ISBLANK(D$2), 6), TRUE)
It said there was a circular dependency detected, and I'm not sure if it could work at all or if SWITCH is just not the right function.
Here is a Link to the Spreadsheethttps://docs.google.com/spreadsheets/d/1SdlgcIzFkk2mAnAm7ilhYmDtjWEeZrJy8p6NBfXNRx8/edit?usp=sharing