# Sumif function not working.Returning zero

• In sheet2, Cells C5 and E5 the formula

=SumIf(Sheet1!B2:B27,">7 Days", Sheet1!D2:D27)

=SumIf(Sheet1!B2:B27,">30 Days", Sheet1!D2:D27)

is returning 0. Any idea why this is happening?

• Try it like

=SUMIF(Sheet1!B2:B27,"=>7 Days", Sheet1!D2:D27)

• Try,

=SUMPRODUCT((0+LEFT(Sheet1!B2:B27,FIND(" ",Sheet1!B2:B27)-1)>7)* Sheet1!D2:D27)

Or,

=SUMPRODUCT((0+LEFT(Sheet1!B2:B27,FIND(" ",Sheet1!B2:B27)-1)>30)* Sheet1!D2:D27)

• Then Fluff's formula should work, unless the values in column D are actually text.

Rory
Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

• If it's not working, can you supply a sample workbook

• Try it like

=SUMIF(Sheet1!B2:B27,"=>7 Days", Sheet1!D2:D27)

Hi Fluff13,

I just gave it a try and it worked like a charm. Can you please help me understand, how did placing an = sign resolved the issue?

Thanks!

• Without the = sign the formula is treating the > as a comparison, so it's looking for anything that is greater than the text "7 Days"

But with the = sign it treats the > as text