SumIf or SumProduct?

aimee_quaife

New Member
Joined
Sep 20, 2010
Messages
8
Hello!

I'm working on a budget excel spreadsheet. In the workbook I have one spreadsheet called spending record, where I enter the purchases and another which has tables that summarize this info. In the summary table, I'm trying to do a formula that sums all the figures in column D if A=2011,B=Aug,C=Food, but I can't seem to get it to work :confused:

I've tried this so far...

=SUMPRODUCT(--(SPENDING RECORD’!A2:A300=2010),--(SPENDING RECORD’!B2:B300=”aug”),--(SPENDING RECORD’!C2:C300=”food”),--(--(SPENDING RECORD’!D2:D300))

=SUM(IF(‘SPENDING RECORD’!A2:A300=2010,IF(‘SPENDING RECORD’!B2:B300=”aug”),IF(‘SPENDING RECORD’!C2:C300="food",D2:D300)))


Any suggestions would be welcomed!!:)
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
=SUMPRODUCT(--(SPENDING RECORD’!A2:A300=2010),--(SPENDING RECORD’!B2:B300=”aug”),--(SPENDING RECORD’!C2:C300=”food”),--(--(SPENDING RECORD’!D2:D300))

The above should work, but you must be careful whether upper case/lower case matters (it probably does). Also, the values in column B might be real dates formatted to show as month name, or may be text values. It's possible that even the values in A are text rather than numbers -- "2010" instead of 2010.

So it all comes down to knowing if you have text or numbers or dates ... and syntax accordingly. And beware of upper/lower casing.
 
Upvote 0
try
Code:
=SUMPRODUCT(--(A1:A1000=2011)*(B1:B1000="aug")*(C1:C1000="food")*(D1:D1000))
 
Upvote 0
Hello!

I'm working on a budget excel spreadsheet. In the workbook I have one spreadsheet called spending record, where I enter the purchases and another which has tables that summarize this info. In the summary table, I'm trying to do a formula that sums all the figures in column D if A=2011,B=Aug,C=Food, but I can't seem to get it to work :confused:

I've tried this so far...

=SUMPRODUCT(--(SPENDING RECORD’!A2:A300=2010),--(SPENDING RECORD’!B2:B300=”aug”),--(SPENDING RECORD’!C2:C300=”food”),--(--(SPENDING RECORD’!D2:D300))

=SUM(IF(‘SPENDING RECORD’!A2:A300=2010,IF(‘SPENDING RECORD’!B2:B300=”aug”),IF(‘SPENDING RECORD’!C2:C300="food",D2:D300)))


Any suggestions would be welcomed!!:)

The quotes round the sheet names are incomplete.
In SumProduct, the range to sum usually does not need coercing (using the -- bit).
Check carefully whether you want 2000 or 2011.

Just enter:
Code:
=SUMPRODUCT(
    --('SPENDING RECORD'!$A$2:$A$300=2011),
    --('SPENDING RECORD'!$B$2:$B$300=”aug”),
    --('SPENDING RECORD'!$C$2:$C$300=”food”),
    'SPENDING RECORD'!$D$2:$D$300))

Control+shift+enter:
Code:
=SUM(
    IF('SPENDING RECORD'!$A$2:$A$300=2011,
    IF('SPENDING RECORD'!$B$2:$B$300=”aug”,
    IF('SPENDING RECORD'!$C$2:$C$300=”food”,
       'SPENDING RECORD'!$D$2:$D$300))))
 
Upvote 0
Thanks for the suggestions. The sumif formula keeps coming up with 0 even though there are numbers to sum that meets the criteria. I've tried changing the words to have capitals, and treating the number like a date ("2010") but no luck.

The sumproduct keeps coming up with an error message and then highlights in internal (), but I don't know what that means. Or it will say it can find the worksheet spending record and get me to try and open a new file.

If I didn't show the previous formulas and you want to add all the all the food items(C:C) in a worksheet named Spending Record, but only if they were made in aug(B:B) 2010(A:A), AND this summary will be in a separate sheet, what would you do?

Thanks!!
 
Upvote 0
Thanks for the suggestions. The sumif formula keeps coming up with 0 even though there are numbers to sum that meets the criteria. I've tried changing the words to have capitals, and treating the number like a date ("2010") but no luck.

The sumproduct keeps coming up with an error message and then highlights in internal (), but I don't know what that means. Or it will say it can find the worksheet spending record and get me to try and open a new file.

If I didn't show the previous formulas and you want to add all the all the food items(C:C) in a worksheet named Spending Record, but only if they were made in aug(B:B) 2010(A:A), AND this summary will be in a separate sheet, what would you do?

Thanks!!
It sounds like you're describing a COUNT, not a sum.

What version of Excel are you using?

Does column B contain the month names as TEXT entries?

Does column A contain just the year numbers? These are not DATES, right?

What's in column C?
 
Upvote 0
Thanks for your help... I definitely want a sum as I want to total the number of food purchases in column D. Columns A-C are all just formatted as general cells (not number, text or date). I do have them as lists though (I created drop down menus e.g. so I can select from food, car, household bills etc). This hasn't mattered in my past excel sheets where I've done similar formulas, but maybe that's something.

I'm working in Microsoft for Mac 2008 (12.2.8). All my other excel docs I created on a pc, so perhaps that's it? But I just checked my other excel docs and they're all working fine??

Sooo frustrating :mad: Obviously I'm doing something stupid!!
 
Upvote 0
Thanks for your help... I definitely want a sum as I want to total the number of food purchases in column D. Columns A-C are all just formatted as general cells (not number, text or date). I do have them as lists though (I created drop down menus e.g. so I can select from food, car, household bills etc). This hasn't mattered in my past excel sheets where I've done similar formulas, but maybe that's something.

I'm working in Microsoft for Mac 2008 (12.2.8). All my other excel docs I created on a pc, so perhaps that's it? But I just checked my other excel docs and they're all working fine??

Sooo frustrating :mad: Obviously I'm doing something stupid!!
Let's assume this is your data...

Book1
ABCD
1YearMonthItemAmount
22010Jancake18
32010Febcake64
42011Marcake87
52011Janpie87
62010Junpie70
72010Augpie55
82010Augpie95
92011Augcake54
102010Octcake22
Sheet1


To get the sum for pie in Aug 2010...

Use cells to hold the sum criteria:
  • F2 = 2010
  • G2 = Aug
  • H2 = pie
Formula in I2:

=SUMPRODUCT(--(A2:A10=F2),--(B2:B10=G2),--(C2:C10=H2),D2:D10)

Result = 150
 
Upvote 0
Have you tried putting a VALUE formula around your year criteria, keeping the quotation marks, i.e. VALUE("2010")
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

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