I need some help summing costs for a unique ID (which can have 1 or multiple B numbers). I will walk through the scenarios to help understand what I am looking for.
ID = 1: The B Number is the same for entries of ID =1. Thus where ID = 1 and Last is indicated, Cost = 10.
ID = 2: The B Number changes four times. In cell G20 (Last of all ID =2) Cost = 20+30+40+30 = 120. You are basically summing at each instance the B Number changes.
ID = 3: Cell G24 = 100 +30 (two instances of B Number changing)
ID = 4: B Number is always the same. Cost = 50
ID = 5: B number changes 3 times, Cost = 50+120+140 = 310
In essence, the idea is that if the ID matches for all rows of particular client, the total cost = individual cost. However, if the ID changes multiple times for a single client, the total cost becomes the sum of changed costs, but not the entire column, just summing at each instance it changes. And this summed cost must be entered whenever we see the last instance of a unique ID (This is indicated using Column F).
The problem that I'm running into is that currently I am doing this manually with my actual data set (has nearly 200,000 rows). What excel function or VBA code could I write to automate this entire process?
Thanks for the help.
Bookmarks