×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Conditional sum, with 2 conditions2

## Conditional sum, with 2 conditions

(OP)
I have to sum a column data when, not just one condition is met, but 2.

In my case the year and the month of a date must equal to what I want.

Is that possible?
Replies continue below

### RE: Conditional sum, with 2 conditions

Hello,

Try this formula

=SUMPRODUCT(--(A1:A5="Jan"),--(B1:B5=2004),(C1:C5))

A      B    C
1   Jan    2004  1
2   Feb    2004  2
3   Jan    2004  3
4   Apr    2004  4
5   May    2004  5

----------------------------------
Hope this helps.
----------------------------------

maybe only a drafter
but the best user at this company!

### RE: Conditional sum, with 2 conditions

(OP)
I found a good solution...

Since month never overtook 12 and day never overtook 31 it is enough strip all the date in a single number, like this:

E.G.
13/06/2004 is the date (cell a1)
with the formula
=year(a1)*10000+month(a1)*100+day(a1)
become
20040613 easily usable for conditions :)

in my case I needed only the month so it'll become
=year(a1)*100+month(a1)
for 200406

### RE: Conditional sum, with 2 conditions

Or you can convert the date to a number (ie. 2 April 04 = 38022). Therefore you only need one condition.

### RE: Conditional sum, with 2 conditions

2
Hi Melko,
Probably you already have a solution but i found a general solution for such problems in the website of j-walk, "Excel Developer tip". The formula we use for conditional summing is SUMIF. But for multiple criteria in different fields, the SUMIF function doesn't work. However, you can use an array formula. Remember, When you an array formula, press ctrl+Shift+Enter after you write it.

For example
Sum of Sales where Month="Jan" AND Region="North"

=SUM((A2:A10="Jan")*(B2:B10="North")*C2:C10)

Enjoy!

### RE: Conditional sum, with 2 conditions

(OP)
Array formulas? What is that?
Wow, I have to try...

### RE: Conditional sum, with 2 conditions

An array is a group (a list or a table) of data such as  matrix. In EXCEL you can perform certain matrix calculations with array formula. Just see help for matrix calculations.

### RE: Conditional sum, with 2 conditions

Melko,

I think you have nailed it with your first solution above, but otherwise you can combine logical IF and AND functions, i.e.

=IF(AND(condition1,condition2)=TRUE,SUM(C6:C15),"")

for example.

### RE: Conditional sum, with 2 conditions

(OP)
JohnGP,

I am afraid that is do not work that way.
I mean, if both condition are true I'll just have the sum of ALL data in the c6:c15 and not only the ones that respect the condition and if both condition are not meet I'll just hve nothing.

Am I wrong?

### RE: Conditional sum, with 2 conditions

Oops, sorry Melko, my perception of the issue was obviously flawed.....I'll dig myself another hole.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!