Sumif?

greeced

New Member
Joined
Sep 29, 2011
Messages
9
Here's an example of a spreadsheet.

Column A [] Column B [] Column C
------------------------------------
Gas ----------------------30
--------------Util---------20
--------------Gas ---------50

I've looked far and wide and couldn't figure this out. Lets say I want to Sum up column C only if Gas is in Column A - OR - Column B.

So in the above example the amount should return 80.

Also, should there come a time that Gas is in both columns, I'd only like that line to be counted once, not twice.

Any idea how to do this? I've tried and searched everywhere with no success.

Please help
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
You can use this:


=SUMPRODUCT(ISNUMBER(SEARCH("Gas",C21:C100))+ISNUMBER(SEARCH("Gas",F21:F100)),K21:K100)


Sorry my friend, looks like I ran into another problem using this formula.

If "Gas" appeares in colum C and in Column F, it will add the amount in column K twice. I only want to have it sum the row value of K once if "Gas" appears in either of the two other columns.

Your previous formula worked for this, however this one doesn't.

Any ideas?
 
Upvote 0
Sorry my friend, looks like I ran into another problem using this formula.

If "Gas" appeares in colum C and in Column F, it will add the amount in column K twice. I only want to have it sum the row value of K once if "Gas" appears in either of the two other columns.

Your previous formula worked for this, however this one doesn't.

Any ideas?

Either...

Just enter:
Rich (BB code):
=SUMPRODUCT(--(ISNUMBER(SEARCH("Gas",C21:C100))+
   ISNUMBER(SEARCH("Gas",F21:F100))>0),K21:K100)

Or...

Control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(ISNUMBER(SEARCH("Gas",C21:C100))+
   ISNUMBER(SEARCH("Gas",F21:F100)),K21:K100))
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

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