Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
123
返回列表 发新帖
楼主: 张雄友

[已解决]极端难度求和哪一列隐藏了哪一列就不参与计算

[复制链接]
 楼主| 发表于 2014-5-15 07:53 | 显示全部楼层
dsmch 发表于 2014-5-13 20:42

将D:I全部隐藏后,最大与最小值计算出错。0才对。
回复

使用道具 举报

发表于 2014-5-15 09:02 | 显示全部楼层
没有值,也就没有最大最小值,还是初始值,增加一个判断
回复

使用道具 举报

 楼主| 发表于 2014-5-15 12:58 | 显示全部楼层
dsmch 发表于 2014-5-15 09:02
没有值,也就没有最大最小值,还是初始值,增加一个判断

怎么增加?
回复

使用道具 举报

发表于 2014-5-15 14:51 | 显示全部楼层
Function PJ(rng) '平均值
On Error Resume Next
Application.Volatile
For Each cel In rng
If cel.EntireColumn.Hidden = False Then
s = s + cel.Value
s2 = s2 + 1
End If
Next
PJ = Application.Round(s / s2, 2)
End Function

Function ZDZ(rng) '取最大值
Application.Volatile
s = -10 ^ 8 '定义一个最小值
For Each cel In rng
If cel.EntireColumn.Hidden = False Then
If cel.Value > s Then s = cel.Value
End If
Next
ZDZ = IIf(s = -10 ^ 8, "", s)
End Function

Function ZXZ(rng) '取最小值
Application.Volatile
s = 10 ^ 9 '定义一个最大值
For Each cel In rng
If cel.EntireColumn.Hidden = False Then
If cel.Value < s Then s = cel.Value
End If
Next
ZXZ = IIf(s = 10 ^ 9, "", s)
End Function

评分

参与人数 1 +3 收起 理由
张雄友 + 3 很给力!

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-29 09:59 , Processed in 0.125135 second(s), 9 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表