Multiple Strings in a Sum if Formula

the k-man

New Member
Joined
Jan 18, 2005
Messages
2
Good Afternoon,

On a spreadsheet that I am working on I have four columns: Bid, Category (which has four possible categories - B, N, E & I), Type (Which has three fixed categories down the column such - Op, Dep & Cap), and Value (a dollar amount that will correspond to the categories under 'Type' where applicable). Each Bid will fall under only 1 category, but may have dollar value for each Type i.e. each Bid will have four columns associated with it (Bid, Category, Type, and Value), and up to three rows (Op, Dep, and Cap). I have attempted to produce an example below (sorry have had to use underscore to get the columns correct as i cant download the HTML maker):

Bid / Category / Type / Value

1______ B______Op______5
_______ B______Dep_____2
_______ B______Cap_____10

2_______N______Op______10
________N______Dep______0
________N______Cap______0

(In Bid 2 above, the Dep and Cap rows would be deleted as they contain no values)

Currently i have three SUMIF formulae at the bottom of the sheet which sums only those values that correspond to each category of the column 'Type' E.g.: =SUMIF($C$2:$C$7,"Op",D2:D7) will only pick up those figures in the value column if they correspond to "Op". So based on the above example, my total will be 10.

What I would like to do now is put a further condition on this formula so that it will discriminate the result further based on a Category. For example given the above formula, I would now like to sum those "op" values that correspond to the category 'B', which will give me a total of 5.

Confused yet? :eek:
As you can see, I am an Excel novice so any help would be greatly appreciated! :)

k-man
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
You could do something like this:
Book1
ABCDEFG
1BidCategoryTypeValue
21BOp5Op & B5
3BDep2
4BCap10
52NOp10
6NDep0
7NCap0
Sheet1


Formula in G2 is:
=SUMPRODUCT(($B$2:$B$7="B")*($C$2:$C$7="Op"),$D$2:$D$7)

You could put those conditions in separate cells instead of hard-coding them. For example:
=SUMPRODUCT(($B$2:$B$7=E2)*($C$2:$C$7=F2),$D$2:$D$7)
where E2="B" and F2="Op"

That way, you could see the totals of different conditions without having to change your formula.

Hope that helps!
 

Forum statistics

Threads
1,148,396
Messages
5,746,452
Members
424,020
Latest member
LongDoo

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
Top