跳到主要內容

如何在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選項卡為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