# If column contains value, return the sum of another column

#### alloakland1

##### New Member
I would like to return the sum of a column if another column equals a criteria.

For example:
This is a data sheet that I am getting my info from (Sheet1)
A1 company B Location C Total Gross
2.Vizio San Francisco \$100
3.Sony Denver \$1000
4.Samsung New York \$200
5.Apple Denver \$400

I would like to put a formula in another sheet (Sheet2) with the list of companies in Column A and Location in the first row.
I've tried =IF(Sheet1!A:A="Vizio",SUMIF(Sheet1!B:B,"San Francisco",Sheet1!C:C),0)

How would I return Total Gross based on both the company and location?

### Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Which version of Excel are you using?

In XL2007+ we have sumifS
=SUMIFS(Sheet1!C:C,Sheet1!A:A,"Vizio",Sheet1!B:B,"San Francisco")

XL2003 or earlier, you need sumproduct
=SUMPRODUCT(--(Sheet1!A1:A1000="Vizio"),--(Sheet1!B1:B1000="San Francisco"),Sheet1!C1:C1000)

Note, you can't use entire column references in sumproduct xl2003, must specify row #s

Last edited:
I unfortunately have excel 2003

WOw you are a life saver THANK YOU!!!!

Glad to help, thanks for the feedback.

One last question... how do I use the formula if i wanted to count if Total Gross doesn't equal 0?

I tried this formula but didn't work: =SUMPRODUCT(--(Sheet1!A1:A1000="Vizio"),--(Sheet1!B1:B1000="San Francisco"),Sheet1!C1:C1000<>0)

Almost, try

I tried this formula but didn't work: =SUMPRODUCT(--(Sheet1!A1:A1000="Vizio"),--(Sheet1!B1:B1000="San Francisco"),--(Sheet1!C1:C1000<>0))

THANKS AGAIN MR MVPPPPPPPPPPP!!!!!! You ARE THe MVP!

You're welcome.

Replies
10
Views
158
Replies
11
Views
174
Replies
10
Views
715
Replies
5
Views
156
Replies
6
Views
140

1,196,502
Messages
6,015,583
Members
441,902
Latest member
alhaste

### 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.

### Which adblocker are you using?

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

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