Compare values per group and remove group if value differs

Hi, is it possible to compare values (time/length) per group and remove these lines (or groups) if the difference is bigger than 5 seconds?

For example, in the picture below, the length (column G) of the highlighted tracks differs and it is bigger than 5 seconds, how can i remove those from the sheet.

Thank you!

X2: =OR(AND($F2=$F3 ; $G2-$G3>TIME(0;0;5)) ; AND($F1=$F2 ; $G1-$G2>TIME(0;0;5))
t85984.ods (11.6 KB)

@rosgrt1000 :

Generally:

  1. If your issue isn’t explicitly concerning the view, always attach a (reduced / cleaned from confidential content / simplified but substantial) file, in this case a .ods type.
  2. Show what you have (including possible variants), but also very clearly what you want to get finally.

In this case:

  1. Make unmistakeably clear what your groups are. Do you mean the contents of already grouped rows?
  2. If you are talking of grouped rows: How to read the “OR” in remove these lines (or groups) Is this about ungrouping? Is it about deletion of rows?
  3. What about the many strange “2” in column A?
  4. Are all your “groups” assured to have atleast/atmost/exactly two elements?

You shouldn’t expect contributors to create examples and to suggest solutions for every thinkable case.