#### NeilATaylor

##### Board Regular

- Joined
- Aug 7, 2007

- Messages
- 185

I would really like to see a macro that does the following, I'm sure someone has something already like this, if so, please share!

I have a worksheet of 5 columns. What I would like to do is subtotal an amount in column d, where the item code in column b are the same. Lets say there are 5 rows with code 8150 in column b, I want to add all these rows up BUT ALSO add up any rows which are 8150+1 (x+1) i.e. 8151. All transactions where the code in column B, x + (x+1) = 0. All true results should then be cut and pasted into a new worksheet (one worksheet for all transactions that are true).

e.g.

8150 1233

8150 12

8150 644

8151 -2084

8151 -10

8151 -205

Total of above amounts is zero, therefore cut and paste to new spreadsheet.

Now that I think about it, its actually quite complicated.

Any ideas?

Thanks in advance

Neil