Conditional sum, with 2 conditions
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?
In my case the year and the month of a date must equal to what I want.
Is that possible?
RE: Conditional sum, with 2 conditions
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
Answer will be 4
----------------------------------
Hope this helps.
----------------------------------
maybe only a drafter
but the best user at this company!
RE: Conditional sum, with 2 conditions
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
RE: Conditional sum, with 2 conditions
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
Wow, I have to try...
RE: Conditional sum, with 2 conditions
RE: Conditional sum, with 2 conditions
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
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