# Excel sum formula help needed

#### mbb4331

##### Board Regular
I have a sum formula to sum all cells in row C where Row A = "Total Revenue" and Row B (date field) is before "10/1/2005".

Currently, the formula ignores the date argument and sums all rows where Column A = "Total Revenue".

Does anyone have any ideas?

{=SUM(IF(TRIM(A2:A15)="Total Revenue", IF(B2:B15<"10/1/2005", C2:C15)))}

Thanks!

### Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

#### bk

##### Active Member
I just tried it and your formula seemed to work on the date portion.

Maybe you can eliminate the first part of the formula for a moment and make sure that section is working for you. And then expand back out.

I can throw out some wild guesses why the comparison would work when I tried it and doesn't work for you, but that's all they'd be. (Maybe formats that keep dates from being read as dates, etc.)

Not sure how helpful that is. But your formula itself doesn't look wrong to me.

#### jss1234

##### Active Member
Try adding this formula to cell D2:

=IF(OR(--YEAR(B2)<2005,AND(--YEAR(2)=2005,--MONTH(B2)<10)),1,0)

Copy and past down the formula

=SUMPRODUCT(--(A2:A15="Total Revenue"),--(D2:D15=1),--(C2:C15))

#### Von Pookie

##### MrExcel MVP
This seems to work for me:

Code:
``=SUMPRODUCT(--(TRIM(\$A\$2:\$A\$15)="Total Revenue"),--(\$B\$2:\$B\$15<DATE(2005,10,1)),\$C\$2:\$C\$15)``

#### mbb4331

##### Board Regular

It looks like the issue was 'B2:B15<"10/1/2005"'.

'DATE(2005, 10, 1)'
did the trick."

Thanks all!

#### mbb4331

##### Board Regular
btw, what do the "--" entries represent?

#### jss1234

##### Active Member
They make all values that can be numbers act like numbers, even if they are entered as text - ie entered as '5 instead of just 5

Replies
6
Views
48
Replies
1
Views
62
Replies
10
Views
333
Replies
1
Views
186
Replies
6
Views
50