# Sumif

#### Dorothych

##### New Member
I have country(Col A) , product(Col B) in Sheet 1, and I need to extract information from Sheet 2 which has the same format as Sheet 1. On Sheet 1 Col C, I need to know a total quantity purchase for Country and by Product. On sheet 2, it looks something like :

Brazil , TV , 5
India, Oven , 8
Brazil , Tv , 8
Brazil , Oven , 9

Say, on Sheet 1 Row 3

Brazil, Tv , QTY???
Can I use Sum if (with 2 criteria - Col A & B) result = sum of qty.
I hope this is not too confusing

Dorothy

### Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

#### Dorothychin

##### Board Regular
Can anyone pls help?

#### plettieri

##### Well-known Member
It looks like you might want to try a pivot table using two multiple consolidation ranges. The pivot table wizard will walk you through the steps.... DATA | Pivot table

Hope this helps...

pll

#### zzydhf

##### Board Regular
Try this:
{=SUM(IF(Sheet2!\$A\$2:\$A\$16=A2,IF(Sheet2!\$B\$2:\$B\$16=B2,Sheet2!\$C\$2:\$C\$16)))}

Do not type the {}. when entering the formula, do not hit enter or tab or arrow, you must hit Ctrl+Shift+Enter
HTH

#### Yogi Anand

##### MrExcel MVP
Hi Dorothy:

Considering the data on the same sheet, I have used the SUMPRODUCT formula to calculate Brazil TV combination sum -- see the worksheet simulation ...<SPAN id='ForSubmit'>
y021008a.xls
ABCDEFG
1BrazilTV5Brazil
2IndiaOven813TV
3BrazilTV8
4BrazilOven9
Sheet1
</SPAN>

or if your table is in Sheet2, then you can use the following formula in sheet1

'=SUMPRODUCT((Sheet2!A1:A4=G1)*(Sheet2!B1:B4=G2)*(Sheet2!C1:C4))

Regards!

Yogi
This message was edited by Yogi Anand on 2002-10-08 23:17

#### Fryer Tuck

##### Board Regular
I took a different tact, with one extra step. In column D of Sheet2 (you could put it in column A and hide it if you want), put the concatenation of A and B (just use the formula "= A2 & B2")

Then in column C of sheet 1, put the formula

=SUMIF(Sheet2!D\$1:D\$4,A2 & B2,Sheet2!C\$1:C\$4)

You can copy this down through all the matches.

F.T.

#### ElectricSkywalker

##### Board Regular
Hi guys,

I was just playing around with a the formulas that you all provided, and I really love them.

Just for anyone else out there who might be experimenting....

I discovered with "zzydhf's" formula that uses the Array function {}, that if I didn't ensure the ranges were exactly the same, then I would get an error.

Such as:

INCORRECT VERSION:
{=sum(if(A2:16=A2, if(B2:B16=B2, C2:C32)))}

CORRECT VERSION:
{=sum(if(A2:16=A2, if(B2:B16=B2, C2:C16)))}

I learned this the hard way - so keep an eye on your Ranges!

Cheers,
Greg

P.S. These are wicked formulas :0)

Replies
10
Views
230
Replies
2
Views
87
Replies
5
Views
257
Replies
4
Views
125
Replies
3
Views
397

Threads
1,181,108
Messages
5,928,109
Members
436,588
Latest member
mummabare

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

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