0
votes
    |    A      B             C                 D        |    E          F       |     G        H
----|----------------------------------------------------|-----------------------|-------------------
1   |                                                    |                       |    
2   |        Products        date            quantity    |                       |
----|----------------------------------------------------|-----------------------|-------------------
3   |        Product_A       2020-01-08          0       |   From     2020-01-01 |  Result:     800
4   |        Product_A       2020-12-15          0       |   to       2020-10-31 |
5   |        Product_A       2020-12-23          0       |                       |
6   |        Product_A                         500       |                       |
----|----------------------------------------------------|-----------------------|------------------
7   |        Product_B       2020-11-09          0       |                       | 
8   |        Product_B       2021-03-14          0       |                       |
9   |        Product_B                         700       |                       |
----|----------------------------------------------------|-----------------------|------------------
10  |        Product_C       2020-02-05          0       |                       |
11  |        Product_C       2020-07-19          0       |                       |
12  |        Product_C       2020-09-18          0       |                       |
13  |        Product_C       2020-09-25          0       |                       |
14  |        Product_C                         300       |                       |
14  |                                                    |                       |
15  |                                                    |                       |

In the table I have listed different products with multiple dates per product.
Below each product there is a row in which a quantity is displayed.

Now in Cell H3 I want to get the Sum of the quantity of all products that have at least one date between the dates in Cell F3 and Cell F4. In the example this applies to Product_A and Product_C therefore the sum is 500+300=800.

I have no clue what kind of formula I need to achieve this.
I guess it must be something like this:

SUMIFS(Date in Cell F3 OR in Cell F4 exists for Product in Column C THEN SUM over Column D)

Do you have an idea how this formula has to look like?

1

1 Answers

1
votes

One way would be with SUMPRODUCT() combined with COUNTIFS():

=SUMPRODUCT((COUNTIFS(B3:B14,B3:B14,C3:C14,">="&F3,C3:C14,"<="&F4)>0)*D3:D14)