Sumif

Dorothych

New Member
Joined
Sep 18, 2002
Messages
7
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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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)
 
Upvote 0

Forum statistics

Threads
1,213,483
Messages
6,113,919
Members
448,533
Latest member
thietbibeboiwasaco

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