0
votes

Problem

I have a table in Excel with a date range and quantities. I need to sum the quantities based date range from today and older then 30, 60, 90, etc days.

Logic

  1. If the product was created within 30 days SUM qty.
  2. If the product was created between 30 days and 60days, SUM qty.
  3. If the product was created between 60 days and 90days, SUM qty.

Expected Results

  1. Qty would equal to 24 (24)
  2. Qty would equal to 32 (12+11+9)
  3. Qty would equal to 26 (10+1+10+5)

Table

CREATED AT    QTY
01/02/2016    10
01/02/2016    1
03/02/2016    10
05/02/2016    5
01/03/2016    12
02/03/2016    11
06/03/2016    9
12/03/2016    24
1

1 Answers

0
votes

Use SUMIFS():

=SUMIFS(B:B,A:A,"<=" & Today() + 1,A:A,">=" & Today() - 30)

Change the + 1 to -30 and the - 30 to - 60 and so forth.

Or you can set up a small table where you have the end dates listed in a column then you can simply use something like this:

=SUMIFS(B:B,A:A,"<=" & TODAY() - D2 + 31,A:A,">=" & TODAY() - D2)

enter image description here