Date Formula with SUMIF

DJ'sGiGi

Board Regular
Joined
May 25, 2007
Messages
92
Is there a reason Excel won't perform the SUMIF function on a cell with a date formula? In the example below, Excel ignores the SUMIF when I have a formula A6:A18. But if I simply type in values, it calculates fine. My entries are serial dates formatted as a date. I’ve even tried =SUMIF($A$6:$A$18,”=”&A6,$B$6:$B$18) and that doesn’t work either.

<PRE>
9/16/2014 OFF 0.00 "=SUMIF($A$6:$A$18,A6,$B$6:$B$18)"
9/17/2014 0.50 0.50
9/17/2014 0.75 0.75
9/18/2014 0.25 0.25
9/18/2014 0.00
0.00
0.00 </PRE>

Assistance is appreciated.
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

BiocideJ

Well-known Member
Joined
Jan 23, 2012
Messages
1,733
If the dates are serial then I suspect the culprit is encoded TIME data.
You can check this by changing the cell formatting to general and see if the value is an INTEGER or if it has decimal information (Decimal values represent times)
If you want to consider 9/17/14 9:00AM equal to 9/17/14 10:00AM then you need to work with the INTEGER portion only with a formula such as the following...

=SUMPRODUCT(--(INT($A$6:$A$18)=INT(A7)),$B$6:$B$18)
 

DJ'sGiGi

Board Regular
Joined
May 25, 2007
Messages
92
If the dates are serial then I suspect the culprit is encoded TIME data.
You can check this by changing the cell formatting to general and see if the value is an INTEGER or if it has decimal information (Decimal values represent times)
If you want to consider 9/17/14 9:00AM equal to 9/17/14 10:00AM then you need to work with the INTEGER portion only with a formula such as the following...

=SUMPRODUCT(--(INT($A$6:$A$18)=INT(A7)),$B$6:$B$18)


BiocideJ,

You are correct, when formatted as general, I get a decimal value. However, your formula returns a #VALUE (even if I enter it as an array.) Also, what does the -- represent between the 2 parens after sumproduct?

Thanks.
 

BiocideJ

Well-known Member
Joined
Jan 23, 2012
Messages
1,733
If it is giving an error then there must be some non-numeric value in either A6:A18 or B6:B18 which is preventing the SUM portion of the SUMPRODUCT from working.

Also, I noticed that =SUMPRODUCT(--(INT($A$6:$A$18)=INT(A7)),$B$6:$B$18)
should be
=SUMPRODUCT(--(INT($A$6:$A$18)=INT(A6)),$B$6:$B$18)

The -- forces the logical expression (A6:18=A6) to convert from a series of TRUE & FALSE to a series of 1 and 0 so they can be correctly multiplied by the range B6:B18

i.e.
=--TRUE evaluates to 1
and
=--FALSE evaluates to 0
 

DJ'sGiGi

Board Regular
Joined
May 25, 2007
Messages
92
If it is giving an error then there must be some non-numeric value in either A6:A18 or B6:B18 which is preventing the SUM portion of the SUMPRODUCT from working.

Also, I noticed that =SUMPRODUCT(--(INT($A$6:$A$18)=INT(A7)),$B$6:$B$18)
should be
=SUMPRODUCT(--(INT($A$6:$A$18)=INT(A6)),$B$6:$B$18)

The -- forces the logical expression (A6:18=A6) to convert from a series of TRUE & FALSE to a series of 1 and 0 so they can be correctly multiplied by the range B6:B18

i.e.
=--TRUE evaluates to 1
and
=--FALSE evaluates to 0

Correct you are sir! The formula stops calculating the date after the end of the billing period. So in effect, it's returning an error. Guess I need to add an if(iserror) statement.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,028
Messages
5,526,332
Members
409,696
Latest member
EERS

This Week's Hot Topics

Top