跳到主要内容

如何在Excel中的条件格式中忽略空白或零单元格?

假设您有一个包含零个或空白单元格的数据列表,并且想要有条件地格式化该数据列表,但是忽略了空白或零个单元格,您会怎么做? 在本文中,我们将向您展示如何在忽略Excel中的空白或零单元格的情况下使用条件格式。

忽略Excel中条件格式的空白单元格
忽略Excel中条件格式的零单元格


忽略Excel中条件格式的空白单元格

为数据列表创建条件格式设置规则后,您需要添加新规则以忽略列表中的空白单元格。

1.继续留在 条件格式规则管理器 对话框,然后单击 新规则 按钮。 看截图:

备注:您可以打开 条件格式规则管理器 通过单击对话框 条件格式 > 管理规则主页 标签。

2.然后进入 新格式规则 对话框。 您可以通过以下两种方法来忽略条件格式中的空白单元格。

方法1

  • 一种。 选择 仅格式化包含以下内容的单元格 ,在 选择规则类型 框;
  • 湾 选择 空白 ,在 仅格式化带有 下拉列表;
  • C。 不要选择任何格式,然后单击 OK 按钮。 看截图:

方法2

  • 一种。 在里面 选择规则类型 框中选择 使用公式来确定要格式化的单元格;
  • b。 复制并粘贴公式 = ISBLANK(A2)=真格式化此公式为真的值 框;
  • 备注:此处公式中的A2是所选范围的第一个单元格。 例如,您选择的范围是B3:E12,则需要在公式中将A2更改为B3。
  • C。 点击 OK 按钮,不指定任何格式。

3.然后返回到 条件格式规则管理器 对话框。 无论您使用哪种方法忽略空格,都需要检查 如果为真,则停止 该对话框中的框,然后单击 OK 按钮。 看截图:

然后,选定的单元格将被格式化(空格除外)。


忽略Excel中条件格式的零单元格

如果您具有B2:B12范围内的数据列表,并且希望格式化其中的最低XNUMX个值,但忽略零单元格,请执行以下操作。

1.选择范围B2:B12,然后单击 条件格式 > 新规则主页 标签。

2.在 编辑格式规则 对话框,您需要:

  • 1)。 在里面 选择规则类型 框中选择 使用公式来确定要格式化的单元格;
  • 2)。 复制并粘贴公式 =AND(B2<>0,B2<=SMALL(IF(B$2:B$12<>0,$B$2:$B$12),5))格式化此公式为真的值 框;
  • 3)。 点击 格式 用于指定单元格格式的按钮;
  • 4)。 指定格式后,点击 OK 按钮。 看截图:

备注:您需要更改公式中的单元格范围以满足您的需求。

之后,您可以看到所选列表中最低的五个值立即被格式化,而没有格式化零值。


相关文章:

最佳办公生产力工具

🤖 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 (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Literally none of this is working for me. I simply want to highlight anything 9 & below as green and anything 10 and above as red AND any cells that do not have a number stays empty/white. I have done every way of formatting and no matter what I do, all blank cells are green.

What's the deal?? I am using a VLOOKUP formula to locate the data, is that messing up the conditional formatting?
This comment was minimized by the moderator on the site
Hi Penny,

After adding you rules, create a new Formula rule and use this formula =ISBLANK(B2)=TRUE (B2 is the first cell of the selected range). When it returns to the Conditional Fprmatting Rules Manager, check the Stop if True box at the end of the ISBLANK rule, then click the OK button.
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/ignore-blank.png
This comment was minimized by the moderator on the site
Thank you so much! This helped me solve a problem! :)
This comment was minimized by the moderator on the site
Please help with this problem. I am trying to apply conditional formatting for these cells
For example: E5 is Y(Y can only be selected within (C:E)) but I5 in (G:I) and M5 in (K:M) are blank then I5 M5 will be shaded as red using these 2 formulas
- IF(AND(C5="Y", ISBLANK(G5), ISBLANK(K5)),TRUE,FALSE).
OR
- AND(C8="Y",G8="",K8="")
These 2 formulas only shade the cells from the adjacent range. For the example above it only shades I5 but if I enter Y in H6, L6 will be shaded
This comment was minimized by the moderator on the site
just an FYI, if you don't click stop if true before clicking apply, the rule will not work. even if you go back and click stop if true, it won't work.
This comment was minimized by the moderator on the site
THANKS MATE, you save me.
This comment was minimized by the moderator on the site
Neat solution and the way to go if you're using the inbuilt options for your other conditional formatting or have multiple rules, but if you are using a formula to determine formatting you can ignore blanks with a single rule by encapsulating your formula within an IF statement: =IF([CellRef]="","",[Your Formula])
Also your approach stops all further formatting rules, but you might still want to conditionally format a blank cell, e.g. shade or fill it, based on the contents of another cell or other not directly related criteria (although in that case you could re-order the rules).
It's a shame that Microsoft don't just include an 'ignore blanks' tick box on a per rule basis...
This comment was minimized by the moderator on the site
Brilliant! I used this today on a large dataset. Very helpful!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations