跳到主要内容

如何在Excel中仅对可见单元格进行排名?

通常,所有包含过滤值和未过滤值的单元格都将通过Rank函数进行排序。 但是,在某些情况下,您只希望仅对过滤后的值进行排名,这意味着仅对工作表中的可见单元进行排名,如Excel中显示的屏幕截图所示。
doc只对可见的单元格进行排名1

在Excel中仅对可见/过滤的单元格进行排名


箭头蓝色右气泡 在Excel中仅对可见/过滤的单元格进行排名

要仅对可见单元格进行排名,可以应用公式。

选择要放置排名结果的单元格,键入此公式 =SUM(IF(SUBTOTAL(103,OFFSET($A$2:$A$8,ROW($A$2:$A$8)-ROW($A$2),0,1))>0,IF(A2<$A$2:$A$8,1)))+1, 按 Shift + Ctrl + 输入 键,然后向下拖动自动填充手柄以将该公式填充到单元格中。

在公式中,A2是要排名的第一个单元格,A2:A8是要排名的范围。
doc只对可见的单元格进行排名2

然后,当您过滤数据时,可见值将自动重新排名。
doc只对可见的单元格进行排名3

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I can't count, obviously. The rank would be four in a group of four. Duh.
This comment was minimized by the moderator on the site
This seems to use only unique values for the ranking, ignoring values that are duplicated. In a group of four, if there are four values of 1 and we are ranking the value 2, using this formula the rank would be two, not five. Is that correct?
This comment was minimized by the moderator on the site
Hi, Alan Brown, for solving your problem, you need two formulas.
for example, G1:G7 is the column range you want to rank, in H1, type below formula:
=SUMPRODUCT((G1<G$1:G$7)/COUNTIF(G$1:G$7,G$1:G$7))+1
then drag auto fill handle down to H7
in next cell, I1, use below formula:
=RANK($H1,$H$1:$H$7)
press Enter key and drag auto fill handle down to I7, then the rank is finished.
Please let me know if it works, thanks.
This comment was minimized by the moderator on the site
The above Rank only visible cells tip is awesome, Thank you, but CHALLENGE... How do you add excluding zeros to the array formula. I can't seem to get the syntax right to do both Visible and Non-Zero, in one array formula.
This comment was minimized by the moderator on the site
You can use an IF function in a "helper" column to regard it as a very small value e.g. 1E-62 [i.e. enter this function in Column D >> Cell D2 =IF(A2=0,1E-62,A2)]
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations