Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

Excel formula , negate records based on date and type and retrieve unique rows

$
0
0

I have an excelsheet with several rows and columns of data , important columns being Company Name, Date of Transaction , Type of Transaction , Transaction amount. Type of Transacation can be deposit or withdrawal. Now I want to negate(delete) all those rows of records where the deposit and withdrawal are same amount on the same date for the same company. For example

Company Name | Date of Trans | Type of Trans | Trans Amount

ABC          | 1 Jan 2020    | Dep           | 100

ABC          | 1 Jan 2020    | Dep           | 200

ABC          | 1 Jan 2020    | Wit           |-100

ABC          | 2 Jan 2020    | wit           |-500 

DEF          | 10 Jan 2020   | Dep           | 200

DEF          | 10 Jan 2020   | Wit           |-200

XYZ          | 1 Jan 2020    | Dep           | 500

ABC          | 3 Jan 2020    | Dep           | 500

End result should look like

Company Name | Date of Trans | Type of Trans | Trans Amount

ABC          | 1 Jan 2020    | Dep       | 200

ABC          | 2 Jan 2020    | wit       |-500 

ABC          | 3 Jan 2020    | Dep       | 500

XYZ          | 1 Jan 2020    | Dep       | 500

What I have done so far is

1)Concatenate Company name, date of trans and absolute(amount)

2) Sort the dataset based on above Ascending

3) Form an IF statement (check top row, bottom row) on 2 columns for data in step 2

4) Then another if statement (check top row, bottom row) on 2 columns to check on type of transaction type.

But this doesn't work as Type of transaction doesn't necessarily come as DEP-WIT-DEP-WIT in that pattern and date of transaction for same company can be different.

Requesting help. Thanks.


Viewing all articles
Browse latest Browse all 88835


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>