Sumif with 2 Criteria

BlueRhinos

Board Regular
Joined
Aug 31, 2007
Messages
83
Objective: Trying to sum data values in a column that meet 2 conditions. Specifically, the values in column A that equal value D and values in column B that equal value E.
Here's my approach.

=SUM(('WMB Data - JULY'!$E$1:$E$642=A11)*('WMB Data - JULY'!$F$1:$F$642=A10)*'WMB Data - JULY'!$J$1:$J$642)

With CSE applied, I'm getting "#VALUE" and the message - "A value used in the formula is of the wrong data type". Can anyone elaborate and help me fix?

Any help is appreciated!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try SUMPRODUCT instead of SUMIF (this is not an array formula so no need for CTRL + Shift + Enter.
 
Upvote 0
The formula works for me...

Either your values in column J are not real numbers (numbers stored as text)
OR
There are formula errors (#VALUE!) inside one or more cells the formula refers to.
 
Upvote 0
My two cents, I'm certainly not an expert...

First try adding parentheses around the last range. Then, if that doesn't work, try entering "1" in a blank cell and paste special/multiply it down all of your numerical data columns.

Otherwise, wait for someone who knows more to answer...

JACK
 
Upvote 0
Thanks all for the suggestions! As it turns out ,the formula didn't like the column header row being included in the criteria...when I modified the ranges to exclude it worked.

On a different note, I didn't realize sumproduct could help me accomplish. I actually used sumproduct to give me people counts that meant my criteria.

If anyone wants to elaborate on sumproduct's utility, feel free!

BR
 
Upvote 0
Thanks all for the suggestions! As it turns out ,the formula didn't like the column header row being included in the criteria...when I modified the ranges to exclude it worked.

The following...

[1]

Code:
=SUM(
   IF('WMB Data - JULY'!$E$1:$E$642=A11,
   IF'WMB Data - JULY'!$F$1:$F$642=A10,
    'WMB Data - JULY'!$J$1:$J$642)))
is insensitive against including the headers from the relevant ranges and faster than

[2]
Code:
=SUM(
   ('WMB Data - JULY'!$E$1:$E$642=A11)*
   ('WMB Data - JULY'!$F$1:$F$642=A10)*
    'WMB Data - JULY'!$J$1:$J$642)
On a different note, I didn't realize sumproduct could help me accomplish. I actually used sumproduct to give me people counts that meant my criteria.

If anyone wants to elaborate on sumproduct's utility, feel free!

BR

The SumProduct version like the one below...

[3]
Code:
=SUMPRODUCT(
   --('WMB Data - JULY'!$E$1:$E$642=A11),
   --('WMB Data - JULY'!$F$1:$F$642=A10)*
   'WMB Data - JULY'!$J$1:$J$642)
is quite similar to [2], but like [1] it ignores text values (like a header value) that might occur in the range to sum. This one is about as fast as [1].
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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