Sumif on non continuous cells...

sinclasc

New Member
Joined
Aug 19, 2007
Messages
6
Hi
I have a spreadsheet laid out with value, category, value, category, etc, across multiple columns on a spreadsheet. What I need to do is add together all the values in the columns (A,C,E,G, etc)based on the category in the column to the right of it (B,D,F, H, etc). So I'd end up with a total for all the "Banana" category, for example.

I can make it work with a really long, nested collection of IF statements, but is there a more elegant way of doing this?

Before the suggestion...I unfortunately can't change the base data.

Thanks in advance for any responses.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
maybe something like


=SUMIF(B2:H5,"Banana",A2:G5)

[TABLE="class: grid"]
<tbody>[TR]
[TD]Row\Col[/TD]
[TD]
A​
[/TD]
[TD]
B​
[/TD]
[TD]
C​
[/TD]
[TD]
D​
[/TD]
[TD]
E​
[/TD]
[TD]
F​
[/TD]
[TD]
G​
[/TD]
[TD]
H​
[/TD]
[TD]
I​
[/TD]
[TD]
J​
[/TD]
[/TR]
[TR]
[TD]
2​
[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD][/TD]
[TD]
10​
[/TD]
[/TR]
[TR]
[TD]
3​
[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
4​
[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
5​
[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Ah, perhaps I wasn't clear enough. The total needs to be for the row, not grand total. Sorry! So, for example, column J in the above would have the total of all bananas for row 2, 3, etc separately.
 
Upvote 0
maybe something like this than?


[TABLE="class: grid"]
<tbody>[TR]
[TD]Row\Col[/TD]
[TD]
A​
[/TD]
[TD]
B​
[/TD]
[TD]
C​
[/TD]
[TD]
D​
[/TD]
[TD]
E​
[/TD]
[TD]
F​
[/TD]
[TD]
G​
[/TD]
[TD]
H​
[/TD]
[TD]
I​
[/TD]
[TD]
J​
[/TD]
[/TR]
[TR]
[TD]
2​
[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD][/TD]
[TD]
=SUMIF(B2:H2,"Banana",A2:G2)​
[/TD]
[/TR]
[TR]
[TD]
3​
[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD][/TD]
[TD]
=SUMIF(B3:H3,"Banana",A3:G3)​
[/TD]
[/TR]
[TR]
[TD]
4​
[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD][/TD]
[TD]
=SUMIF(B4:H4,"Banana",A4:G4)​
[/TD]
[/TR]
[TR]
[TD]
5​
[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Plum[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD]
1​
[/TD]
[TD]Banana[/TD]
[TD][/TD]
[TD]
=SUMIF(B5:H5,"Banana",A5:G5)​
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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