I am looking for a solution on either Google sheets or app script to check for overlapping dates for the same account. There will be multiple accounts and the dates won't be in any particular order. Here is an example below. I am trying to achieve the right column "check" with some formula or automation. Any suggestions would be greatly appreciated.
Start Date | End Date | Account No. | Check |
---|---|---|---|
2023-01-01 | 2023-01-02 | 123 | ERROR |
2023-01-02 | 2023-01-05 | 123 | ERROR |
2023-02-25 | 2023-02-27 | 456 | OK |
2023-01-11 | 2023-01-12 | 456 | OK |
2023-01-01 | 2023-01-15 | 789 | ERROR |
2023-01-04 | 2023-01-07 | 789 | ERROR |
2023-01-01 | 2023-01-10 | 012 | OK |
2023-01-15 | 2023-01-20 | 012 | OK |
I also found some similar past questions, but they don't have the "for the same account" component and/or requires some sort of chronological order, which my sheet will not have.
How to calculate the overlap between some Google Sheet time frames?
How to check if any of the time ranges overlap with each other in Google Sheets