如何通过仅保留至少一个值超过0的行来过滤枢轴表?

发布于 2025-02-03 12:04:46 字数 751 浏览 2 评论 0原文

我不知道我的问题是否真的很清楚,所以我在这里发展:

我有一个枢轴表,我想滤出每个无值相等或以上1的行。

例如:示例:

标签值1值2
a00
b01
c11
d10
e00

我希望能够对此进行过滤:

标签值1值2
b01
c1 11
d10

是否可以使用Excel? 我到处搜索,找不到枢轴桌子可用的东西...

I don't know if my question is really clear, so I'll develop here:

I have a pivot table, and I would like to filter out every row which has no value equal or above 1.

Example:

labelvalue 1value 2
a00
b01
c11
d10
e00

I would like to be able to filter it to this :

labelvalue 1value 2
b01
c11
d10

is it possible with Excel?
I searched everywhere and I couldn't find anything usable with a pivot table...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海不蓝 2025-02-10 12:04:46

如何过滤枢轴行

执行此操作,我们可以从pivotitemsrowfields中迭代pivotitems,并检查相应的dataRange以符合所示要求。对于那些不合适的人,设置可见= false

滤波行没有等于或大于1的值,我们可以使用此代码:

Sub Macro_FilterPivot()
Dim pvt As PivotTable
Dim item As PivotItem
    With ActiveSheet
        If .PivotTables.Count = 0 Then Exit Sub
        Set pvt = .PivotTables(1)
        For Each item In pvt.RowFields(1).PivotItems
            item.Visible = .Evaluate("OR(" & item.DataRange.Address & ">=1)")
        Next item
    End With
End Sub

How to filter pivot rows

To do this, we can iterate over PivotItems from RowFields and check the corresponding DataRange for compliance with the stated requirement. For those not suitable, set Visible = False

To filter rows with no values equal to or greater than 1 we can use this code:

Sub Macro_FilterPivot()
Dim pvt As PivotTable
Dim item As PivotItem
    With ActiveSheet
        If .PivotTables.Count = 0 Then Exit Sub
        Set pvt = .PivotTables(1)
        For Each item In pvt.RowFields(1).PivotItems
            item.Visible = .Evaluate("OR(" & item.DataRange.Address & ">=1)")
        Next item
    End With
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文