I have a set of data which contains the following:
[TABLE="width: 500"]
<tbody>[TR]
[TD]2008[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2009[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Charge[/TD]
[TD]XYZ[/TD]
[/TR]
</tbody>[/TABLE]
This data repeats, so sometimes the date with the last value in will be 2011, and sometimes the only value will be in the earliest i.e. 2008.
The output I need is:
[TABLE="width: 500"]
<tbody>[TR]
[TD]2008[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2009[/TD]
[TD]Sum all XYZ (where last value in 2009).[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Does anyone have any ideas how to do this?
Thanks so much
[TABLE="width: 500"]
<tbody>[TR]
[TD]2008[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2009[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Charge[/TD]
[TD]XYZ[/TD]
[/TR]
</tbody>[/TABLE]
This data repeats, so sometimes the date with the last value in will be 2011, and sometimes the only value will be in the earliest i.e. 2008.
The output I need is:
[TABLE="width: 500"]
<tbody>[TR]
[TD]2008[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2009[/TD]
[TD]Sum all XYZ (where last value in 2009).[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Does anyone have any ideas how to do this?
Thanks so much