• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Beginning and ending sums once a conditions are met

Carrerpigeon00

New Member
Hello,


I am very new to the word of macros but I think I need one for what I am trying to accomplish here.


I have 4 columns of information:


Column A (an ID column)

Column B (a transaction code)

Column C (the time between the current transaction and the next transaction)


For every time one of three codes (say 100, 150, 175) appears in the Column B, I want to sum Column D until another valid code appears (say 200,250,275) as long as the ID column are the same for all rows.


For instance, lets say you have


ID Code Time Elapse

Row 1 123 103 2

Row 2 123 100 3

Row 3 123 150 3

Row 4 123 170 4

Row 5 123 200 5

Row 6 124 900 6

Row 7 124 150 7

Row 8 124 250 8

Row 9 124 900 10


The sum here would have to start at Row 2 (when one of the 3 starter codes is hit) and stop right before Row 5 (when one of the 3 end codes is hit): 3+3+4 =10 for ID 123 and just 7 for ID 124.


Does anyone have any ideas?


Thanks!
 
Hi, Carrerpigeon00!


First of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.


As a starting point I'd recommend you to read the three first green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).


Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.


Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.


And about your question...


Something's not fully clear with your data and explanation:

a) col A, ID, has values "Row n"?

b) col B, Code, has values 123 and 124?

c) col C, Time, has values 103 and so on?

d) col D, Elapse, has values 2, 3, ...?


Because in your 4th paragraph you write about column B Code values of 100/150/175 and 200/250/275 which doesn't appear at all in your data.


If you're willing to, consider uploading a sample file as indicated at 2nd. green sticky post.


Regards!
 
Back
Top