简体   繁体   English

按日期范围过滤,并按列汇总行值(在Google表格中)

[英]Filter by Date range and sum Row values by Column (in Google Sheets)

Do you have a suggestion on how to make a formula for the problem written in the title? 您对如何为标题中写出的问题制定公式有建议吗?

Here is the example so that you can get an idea of the data format: 这是示例,以便您可以了解数据格式:

Name,Location,Category,Total views for your listing,Total uniqe page views for your listing,Average time on page (listing),total,Facebook,Reviews,Telephone,Treatment Menu,Get Directions,Book Appointment,Enquiry,Instagram,Date
John,NSW Sydney,Apple,1,1,0:00:12,0,0,0,0,0,0,0,0,0,13/Nov/2018
Mike,NSW Sydney,Orange,1,1,0:00:10,0,0,0,0,0,0,0,0,0,13/Nov/2018
Kenny,NSW Sydney,Pear,1,1,0:00:00,4,1,1,1,1,0,0,0,0,13/Nov/2018
John,NSW Sydney,Apple,20,1,0:00:12,0,0,0,0,0,0,0,0,0,14/Nov/2018
Chris,NSW Sydney,Orange,1,1,0:02:48,3,0,0,1,1,1,0,0,0,14/Nov/2018
Stef,NSW Sydney,Orange,10,1,0:07:22,6,1,1,0,1,0,1,1,1,14/Nov/2018

So, the issue is in making a formula that gets put into cells containing numerical values (from D to O), for each of the Name rows. 因此,问题在于要为每个“名称”行创建一个公式,该公式放入包含数值(从D到O)的单元格中。

What it should look like is: 它应该是什么样的:

  • for John and for 13th and 14th of November, the cell in column B in that row should be 21 对于John以及11月13日和14日,该行B列中的单元格应为21
  • for Mike for 13th and 14th, it returns 1 对于Mike在13th和14th,返回1
  • for Jenny, which is not on the list, because she didn't have any values in any of the numerical columns for that day (or a group of days), it should return 0 对于不在列表中的珍妮(Jenny),因为她当天(或几天内)的任何数字列中都没有任何值,因此应返回0

All of these should appear in the "Main Dashboard" sheet, while the data is stored in the "directory statistics" sheet. 所有这些都应显示在“主仪表板”表中,而数据则存储在“目录统计信息”表中。

The predefined list of all the possible Names, Categories and Locations is in the "customList" sheet. 所有可能的名称,类别和位置的预定义列表在“ customList”表中。 This means that we don't need to search through the whole dataset of all the values for all the dates, but rather only search through the Names in the "customList". 这意味着我们不需要搜索整个数据集中所有日期的所有值,而只需要搜索“ customList”中的“名称”。 "Name" should be the key value that connects values in different dates. “名称”应该是连接不同日期中的值的键值。

So far, I have tried with this formula: =Filter('directory statistics'!A2:A,'directory statistics'!$P2:$P=$P2) It looks for the name column (A) and then returns the value if the date entered (in P2) matches the value in that sheet for the date column (P) 到目前为止,我已经尝试使用以下公式:= Filter('目录统计'!A2:A,'目录统计'!$ P2:$ P = $ P2)它查找名称列(A),然后返回值如果输入的日期(在P2中)与该工作表中的日期列(P)中的值匹配

And then I got stuck! 然后我被卡住了! :) :)

Thank you! 谢谢!

I'm not sure why FILTER. 我不确定为什么要过滤。 Assuming Name in A1, and Row 1 and ColumnA in Main Dashboard set up as in my image, then: 假设A1中的Name ,以及Main Dashboard行1和列A如我的图像一样设置,则:

=SUMIFS('directory statistics'!D$1:D$7,'directory statistics'!A$1:A$7,$A2,'directory statistics'!P$1:P$7,">="&B$1,'directory statistics'!P$1:P$7,"<="&C$1)

in B2 and copied down would appear to me to achieve the results you seek. 在B2中复制并抄下来对我来说似乎可以达到您想要的结果。

SO53305042的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM