简体   繁体   English

Excel sumproduct跨多个范围并计算结果

[英]Excel sumproduct accross multiple ranges and COUNT the results

I would like to count the number of occurances of a range of numbers between two dates and am having tremendous dificulty 我想计算两个日期之间某个数字范围的出现次数,并且遇到了很大的困难

On one Workbook we have a data showing the date that an event took place and the ID of the person who hosted the event. 在一个工作簿上,我们有一个数据,显示事件发生的日期和事件主持人的ID。

We then want to tally up the totals on another. 然后,我们要对另一个总数进行总计。

To get the total number of events that took place on a date for a particular group of user IDs we have a workbook with two dates in column A and B and this formula: 为了获取特定用户ID组在某个日期发生的事件总数,我们在A和B列中有一个工作簿,其中有两个日期,并且使用以下公式:

=SUMPRODUCT(('[DATABASE 1.xlsx]Sheet1'!$AB$3:$AB$71692>=A3)*('[DATABASE 1.xlsx]Sheet1'!$AB$3:$AB$71692<=B3)*('[DATABASE 1.xlsx]Sheet1'!$AC$3:$AC$71692>=548)*('[DATABASE 1.xlsx]Sheet1'!$AC$3:$AC$71692>=554)

This gives the total number of events for this group of users between these two dates. 这给出了这两个日期之间该用户组的事件总数。

In a second column we want to know the total number of people from this group who have turned up to any events on this day. 在第二列中,我们想知道这一组中当天发生的任何事件的总人数。 So essentially we want to COUNT the number unique of user IDs between 548 and 554 who have entered records between these two dates. 因此,从本质上讲,我们希望计算在这两个日期之间输入记录的548至554之间的用户ID的唯一编号。

How would this be achieved? 如何实现?

Try this "array formula" 试试这个“数组公式”

=SUM(ISNUMBER(MATCH({548,549,550,551,552,553,554},IF(('[DATABASE 1.xlsx]Sheet1'!$AB$3:$AB$71692>=A3)*('[DATABASE 1.xlsx]Sheet1'!$AB$3:$AB$71692<=B3),'[DATABASE 1.xlsx]Sheet1'!$AC$3:$AC$71692),0))+0)

confirmed with CTRL+SHIFT+ENTER 通过CTRL + SHIFT + ENTER确认

For larger ranges than 548 to 554 , eg 500 to 600 change to this version: 对于大于548 to 554范围,例如,将500 to 600更改为以下版本:

=SUM(ISNUMBER(MATCH(ROW(INDIRECT("500:600")),IF(('[DATABASE 1.xlsx]Sheet1'!$AB$3:$AB$71692>=A3)*('[DATABASE 1.xlsx]Sheet1'!$AB$3:$AB$71692<=B3),'[DATABASE 1.xlsx]Sheet1'!$AC$3:$AC$71692),0))+0)

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

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