过滤数据透视表中0值(Filter 0-values in PivotTable)

2019-10-30 08:26发布

我有以下的Excel电子表格:

      A                  B                    C
    Product         Sent Quantity       Returned Quantity
1   Product A           500                     0
2   Product A           400                   300
3   Product A           600                   400
4   Product B           250                     0
5   Product B           300                   150
6   Product C           700                     0

该表显示的产品的销售( 列B)的返回(C栏 )。

我创建了一个枢轴表上面这导致follwoing结果的数据的:

                Sum of Sent Quantity          Sum of Returned Quantity
Product A           1.500                          700
Product B             550                          150
Product C             700                            0

现在,我使用返回的数量作为报告过滤器 。 我把“150”作为过滤条件,我得到以下结果:

                 Sum of Sent Quantity          Sum of Returned Quantity
Product B             550                          150

到目前为止,一切工作正常。

现在,我从“150”的过滤器更改为“0”,我得到以下结果:

                Sum of Sent Quantity          Sum of Returned Quantity
Product A              500                            0
Product B              250                            0
Product C              750                            0

然而,我的目标结果是:

              Sum of Sent Quantity          Sum of Returned Quantity
Product C              700                            0

我有什么改变,达到我的目标结果呢?

Answer 1:

所以,我已经进入“工作表Sheet1”你的数据是这样的:

然后,在“Sheet2的”我做了如下因素表:

这是您的数据透视表。 但细胞用公式定义为:

B2: =SUMIF(Sheet1!$A$2:$A$7,Sheet2!A2,Sheet1!$B$2:$B$7)

C2: =SUMIF(Sheet1!$A$2:$A$7,Sheet2!A2,Sheet1!$C$2:$C$7)

剩下的只是物质draging下来(它会自动调整,你也知道)。 现在,只需锁定第一行,然后你可以将任何过滤器了。



Answer 2:

这里有一个稍微不同的方式做到这一点,其只需要一个表,并允许您在您的数据透视表筛选和显示值:

      A              B                C                  D
1   Product     Sent Quantity   Returned Quantity   Sum of Returned Quantity
2   Product A       500                 0               700
3   Product A       400               300               700
4   Product A       600               400               700
5   Product B       250                 0               150
6   Product B       300               150               150
7   Product C       700                 0                 0

在细胞D2的公式为=SUMIF($A:$A,$A2,C:C)复制此公式向下的列。

然后设置退货数量之和作为过滤器,它应该正常工作。 其他列可以添加额外的过滤器,如果你愿意,你可以隐藏小计列(S)。



文章来源: Filter 0-values in PivotTable