Excel sum formula help needed

mbb4331

Board Regular
Joined
Dec 22, 2005
Messages
152
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!
 

Some videos you may like

Excel Facts

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

bk

Active Member
Joined
Jun 2, 2002
Messages
387
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
Joined
May 28, 2004
Messages
434
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

Then add this to get your answer:


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

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
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
Joined
Dec 22, 2005
Messages
152

ADVERTISEMENT

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

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

Thanks all!
 

jss1234

Active Member
Joined
May 28, 2004
Messages
434
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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,071
Messages
5,570,022
Members
412,304
Latest member
citrus
Top