In google sheets query,I need to get only non matching debit rows by comparing rows say if amount debited (S1 flag - row 1) matches with amount credited (S1 flag - row 3), it needs to be excluded in the result so I only get know the outstanding debit amount which needs to be credited.
| Flag | Transaction | Amount |
|---|---|---|
| S1 | Debit | 10 |
| S1 | Debit | 10 |
| S1 | Credit | 10 |
| S2 | Debit | 20 |
| S3 | Debit | 50 |
| S3 | Credit | 50 |
Result needs to be look like below:
| Flag | Transaction | Amount |
|---|---|---|
| S1 | Debit | 10 |
| S2 | Debit | 20 |
Thanks in advance.
My Basic query:=QUERY(K2:M9," select K, L, Mwhere K is not null and L = 'Debit'")









