motherindia
Board Regular
- Joined
- Oct 15, 2015
- Messages
- 218
Hello Sir,
I have 2 sheets. Sheet 1 contains 5 columns and Cust No is unique id. I need to combine the Column " Amt" based on Cust No and also to copy the latest value for Type /1002 against SAP Period in separate column. Output is shown below to be appeared on Sheet 2.
I need to automate to do this in VBA.
[TABLE="class: cms_table, width: 624"]
<tbody>[TR]
[TD="colspan: 2"]Input on Sheet 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cust No[/TD]
[TD]Name[/TD]
[TD]SAP Period[/TD]
[TD]Type[/TD]
[TD]Amt[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]A[/TD]
[TD]201005[/TD]
[TD]/1001[/TD]
[TD]-30,637.00[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[TD]200804[/TD]
[TD]/1001[/TD]
[TD]-1,974.00[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[TD]200805[/TD]
[TD]/1001[/TD]
[TD]1,000.00[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]C[/TD]
[TD]200810[/TD]
[TD]/1001[/TD]
[TD]-8,606.00[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]D[/TD]
[TD]200802[/TD]
[TD]/1001[/TD]
[TD]-2,074.00[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]D[/TD]
[TD]200803[/TD]
[TD]/1002[/TD]
[TD]-10,721.00[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]D[/TD]
[TD]200805[/TD]
[TD]/1002[/TD]
[TD]-2,531.00[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Output on Sheet 2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cust No[/TD]
[TD][/TD]
[TD]Total (/1001+/1002)[/TD]
[TD]//1002[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]-30,637.00[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]-974.00[/TD]
[TD]1,000.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]-8,606.00[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]-15,236.00[/TD]
[TD]-2,531.00[/TD]
[/TR]
</tbody>[/TABLE]
Regards,
motherindia
I have 2 sheets. Sheet 1 contains 5 columns and Cust No is unique id. I need to combine the Column " Amt" based on Cust No and also to copy the latest value for Type /1002 against SAP Period in separate column. Output is shown below to be appeared on Sheet 2.
I need to automate to do this in VBA.
[TABLE="class: cms_table, width: 624"]
<tbody>[TR]
[TD="colspan: 2"]Input on Sheet 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cust No[/TD]
[TD]Name[/TD]
[TD]SAP Period[/TD]
[TD]Type[/TD]
[TD]Amt[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]A[/TD]
[TD]201005[/TD]
[TD]/1001[/TD]
[TD]-30,637.00[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[TD]200804[/TD]
[TD]/1001[/TD]
[TD]-1,974.00[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[TD]200805[/TD]
[TD]/1001[/TD]
[TD]1,000.00[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]C[/TD]
[TD]200810[/TD]
[TD]/1001[/TD]
[TD]-8,606.00[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]D[/TD]
[TD]200802[/TD]
[TD]/1001[/TD]
[TD]-2,074.00[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]D[/TD]
[TD]200803[/TD]
[TD]/1002[/TD]
[TD]-10,721.00[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]D[/TD]
[TD]200805[/TD]
[TD]/1002[/TD]
[TD]-2,531.00[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Output on Sheet 2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cust No[/TD]
[TD][/TD]
[TD]Total (/1001+/1002)[/TD]
[TD]//1002[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]-30,637.00[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]-974.00[/TD]
[TD]1,000.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]-8,606.00[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]-15,236.00[/TD]
[TD]-2,531.00[/TD]
[/TR]
</tbody>[/TABLE]
Regards,
motherindia