Difficult sum query - I'm s(t)umped!

ClaireFin

New Member
Joined
Aug 19, 2015
Messages
2
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 :-)
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hard to tell from the data but an if max would work I think

if (Max of column A = Cell A row whatever, sumifs(ColumnB, Column A, 2009),0)
 
Upvote 0
Hard to tell from the data but an if max would work I think

if (Max of column A = Cell A row whatever, sumifs(ColumnB, Column A, 2009),0)

Hi @DebugGalpin

Thanks for your help!

The thing is I need it to sumif the charge amounts, not the amounts displayed next to the date value.

For example, the data sample would look like:

[TABLE="width: 500"]
<tbody>[TR]
[TD]2009[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]2012[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]2013[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Charge[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]2009[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2012[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2013[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Charge[/TD]
[TD]350[/TD]
[/TR]
[TR]
[TD]2009[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2012[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2013[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Charge[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]2009[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2012[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]2013[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Charge[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

The output would need to be as follows:

[TABLE="width: 500"]
<tbody>[TR]
[TD]2009[/TD]
[TD]450 (350+100)[/TD]
[/TR]
[TR]
[TD]2010[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]2011[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2012[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]2013[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top