Date difference

Hi I need to add he inputs from today and less than 30 days. the best formula I go too is

=SUMIF(A4:A11;">TODAY()-30";B4:B11)

 1 Oct 2019	2     10
10 Oct 2019	5
15 Oct 2019	6
01 Nov 2019	7
14 Nov 2019	3
15 Nov 2019	4

Could you please format your input - or provide a sample file.

I just did that…

First off, this

=SUMIF(A4:A11;">TODAY()-30";B4:B11)

won’t compute, because ">TODAY()-30" is just a text string. This will do:

=SUMPRODUCT(A4:A11>(TODAY()-30);B4:B11)

It does not work. It is giving me 27 . The answer should be 20. ie 15 Oct - 15 Nov

It does not work

Please provide your data (a spreadsheet with the formula) that doesn’t work for you. Your comment only means you did it wrong, or you have a different data layout.

And the answer should be 14, not 20: at 2019-11-15, 30 days ago was 2019-10-16.

FTR: here is working sample|attachment.

Thanks. It’s working

Mike’s solution using

=SUMIF(A4:A11;">"&TODAY()-30;B4:B11)

is even better suited for large cell ranges because it avoids creating temporary internal arrays.