如果一个数字在数组中每组出现一次,我该如何计算

How do I count if a number appears once per group in an array

我是 运行 一份报告,我需要计算整数是否出现在数组中;但是,我每组只能数一次。

因此,如果我要在以下群组中寻找 3

Tim  
 1,2  
 1,3,4  
 3  
 3,6,7  

Beth  
 1,3  
 2  
 7,8  

Luke  
 1  
 2,4  
 1  

我会得到 2 的计数,因为它出现在两组中,尽管它在一组中出现了不止一次。

不清楚您如何在数组中查找数字 3

因此,我假设有一个公式 {@ThreeAppearedInArray} returns True if 3 is found in the array else False.

然后你应该得到如下所示的预期结果:

创建一个公式,我们称之为{@ThreeAppeared}

If {@ThreeAppearedInArray} Then
    {yourTable.PersonName}
Else
    "#notAppeared#"

然后创建以下公式来显示非重复计数:

// distinct count of the formula {@ThreeAppeared}-1 (to subtract the "#notAppeared#" value)
DistinctCount ({@ThreeAppeared})-1

编辑

根据您的评论,公式应如下所示:

If Instr({staff_sales.upgrades12}, '1') > 0 Then
    {yourTable.PersonName}
Else
    "#notAppeared#"

重要的是公式 returns 您用来对人员进行分组的列。
{yourTable.PersonName} 替换为适当的列。

然后对该公式进行减 1 的不同计数。