# Excel macro help needed

#### Jaydoubleu

##### New Member
Hi i have a question regarding excel
Below is my worksheet regarding trades:
Name Amount Type Trade Price Position Capital
0
ABI 1000 Sell -1000 19,89 -1000 19890
ABI 1000 Sell -1000 20,18 -2000 20180
ABI 1000 Buy 1000 20,05 -1000 -20045
ABI 500 Buy 500 19,64 -500 -9820
ABI 500 Buy 500 19,73 0 -9862,5
ABI 1500 Sell -1500 19,65 -1500 29475
ABI 500 Buy 500 19,55 -1000 -9772,5
ABI 1000 Buy 1000 19,55 0 -19550
MT 1500 Sell -1500 19,40 -1500 29103,75
MT 1571 Sell -1571 19,41 -3071 30490,49167
MT 1000 Sell -1000 19,36 -4071 19357,5
MT 1000 Buy 1000 19,35 -3071 -19350
MT 1000 Buy 1000 19,36 -2071 -19362
MT 2071 Buy 2071 19,40 0 -40167,045

These are stocktrades, but i would like to calculate the result of my trades. This i want to do by adding up all "capital" fields for every trade which brings my postition back to 0 (Position field). So in this case the first 5 rows are 1 trade, the next 3 and the next 6. I need a macro which looks at the Cum field and if its zero it adds-up all capital fields belonging to that trade, so all capital field starting at that 0 and upwards until the next Position = 0 is reached (excluding that one ofcourse).
Could anyone help me with such a macro? Unfortunatly im not that gifted that i can do this myself.
Regards,
Jay

### Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Replies
17
Views
1K
Replies
10
Views
1K
Replies
1
Views
1K
Replies
3
Views
1K

1,191,319
Messages
5,985,961
Members
439,992
Latest member
NCWalker

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back