Hi All,
First time I am coming to this situation were I don't have any idea how to write a macro for below situation.
1) Unique id is in Column B.
2) Amount is in column C.
3) date of transaction is in column A
I need a macro which will add the amount based on unique ID and create new rows which will have the following and delete old rows.
- last date in date column
- ID in particulars column
- amount in amount column.
[TABLE="width: 330"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Particulars[/TD]
[TD]Amount[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]23-Jul-18[/TD]
[TD]ABC[/TD]
[TD] -3,36,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]24-Jul-18[/TD]
[TD]ABC[/TD]
[TD] 78,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]25-Jul-18[/TD]
[TD]ABC[/TD]
[TD] 48,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]ABC[/TD]
[TD] 54,000 [/TD]
[TD] -1,56,000 [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]23-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] -3,36,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]24-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 2,27,800 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]25-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 98,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]25-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 1,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 54,000 [/TD]
[TD] 44,800 [/TD]
[/TR]
</tbody>[/TABLE]
my output should be as shown below:
[TABLE="width: 262"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Particulars[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]ABC[/TD]
[TD="align: right"]-156000[/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]XYZ[/TD]
[TD="align: right"]44800[/TD]
[/TR]
</tbody>[/TABLE]
First time I am coming to this situation were I don't have any idea how to write a macro for below situation.
1) Unique id is in Column B.
2) Amount is in column C.
3) date of transaction is in column A
I need a macro which will add the amount based on unique ID and create new rows which will have the following and delete old rows.
- last date in date column
- ID in particulars column
- amount in amount column.
[TABLE="width: 330"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Particulars[/TD]
[TD]Amount[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]23-Jul-18[/TD]
[TD]ABC[/TD]
[TD] -3,36,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]24-Jul-18[/TD]
[TD]ABC[/TD]
[TD] 78,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]25-Jul-18[/TD]
[TD]ABC[/TD]
[TD] 48,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]ABC[/TD]
[TD] 54,000 [/TD]
[TD] -1,56,000 [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]23-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] -3,36,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]24-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 2,27,800 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]25-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 98,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]25-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 1,000 [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]XYZ[/TD]
[TD] 54,000 [/TD]
[TD] 44,800 [/TD]
[/TR]
</tbody>[/TABLE]
my output should be as shown below:
[TABLE="width: 262"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Particulars[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]ABC[/TD]
[TD="align: right"]-156000[/TD]
[/TR]
[TR]
[TD]26-Jul-18[/TD]
[TD]XYZ[/TD]
[TD="align: right"]44800[/TD]
[/TR]
</tbody>[/TABLE]