sum value from a date range for a specific product

2020-05-01 04:05发布

I am looking to sum up multiple values from multiple cells where they will match a date and a product.

like below: I have a date set in every cell in row 2 as below, and I have my categories in column A

[display 1]

now I want to pick the total value (that is unit costs) from (below picture) this sheet where the date is equal to 1-dec (date) and the category is equal to office.

[display 2]

I tried using this formula ( =sum(query(DataSheet!A3:J10, "select a,c,i where a= '"&C2&"' and c= '"&A4&"'",0),0) ) - but it is showing me a value error.

please help me to solve this issue.

1条回答
叼着烟拽天下
2楼-- · 2020-05-01 04:49

first you will need to fix those dates:

0try:

then:

=SUM(IFERROR(QUERY(DataSheet!$A3:$J4, 
 "select J 
  where C = '"&$A4&"' 
    and A = date '"&TEXT(C$2, "yyyy-mm-dd")&"'", 0)))

0

查看更多
登录 后发表回答