跳到主要內容

如何在Excel中突出顯示列表中與給定數字最接近的值?

假設您有一個數字列表,現在,您可能想要突出顯示基於給定數字的最接近或幾個最接近的值,如下面的屏幕快照所示。 在這裡,本文可以幫助您輕鬆解決此任務。

doc高亮顯示最接近的值1
doc高亮顯示最接近的值2

使用條件格式突出顯示與給定數字最接近或最接近的n個值


箭頭藍色右氣泡 使用條件格式突出顯示與給定數字最接近或最接近的n個值

要突出顯示基於給定數字的最接近值,請執行以下操作:

1。 選擇要突出顯示的號碼列表,然後單擊 首頁 > 條件格式 > 新規則,請參見屏幕截圖:

doc高亮顯示最接近的值3

2。 在 新格式規則 對話框中,進行以下操作:

(1.)點擊 使用公式來確定要格式化的單元格選擇規則類型 列錶框;

(2.)在 格式化此公式為真的值 文本框,請輸入以下公式: =ABS(A2-$D$2)=MIN(ABS($A$2:$A$15-$D$2)) (A2 是數據列表中的第一個單元格, D2 是您要比較的給定數字, A2:A15 是您要突出顯示最接近的值的數字列表。)

doc高亮顯示最接近的值4

3。 然後點擊 格式 按鈕去 單元格格式 對話框中的 標籤,選擇您喜歡的一種顏色,請參見屏幕截圖:

doc高亮顯示最接近的值5

4。 然後點擊 OK > OK 要關閉對話框,將立即突出顯示最接近特定數字的值,請參見屏幕截圖:

doc高亮顯示最接近的值6

保養竅門:如果您要突出顯示最接近給定值的3個值,則可以在 條件格式, =ISNUMBER(MATCH(ABS($D$2-A2),SMALL(ABS($D$2-$A$2:$A$15),ROW($1:$3)),0)),請參見屏幕截圖:

doc高亮顯示最接近的值7

備註:在以上公式中: A2 是數據列表中的第一個單元格, D2 是您要比較的給定數字, A2:A15 是要突出顯示最接近的值的數字列表, $ 1:$ 3 表示最接近的三個值將突出顯示。 您可以根據需要更改它們。

最佳辦公生產力工具

🤖 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
=ABS(A2-$D$2)=MIN(ABS($A$2:$A$15-$D$2)) данная формула не работает. Пробовал exel 2010 и 2013. Если использовать вторую формулу, ругается на ошибку.
This comment was minimized by the moderator on the site
Hello friend,

Sorry to hear that. But I did try the two formulas and they both work perfectly. Please see the screenshots.
Here is the tip. Please make sure you choose the right range, in my case here, it is A2:A15. Then click Home > Conditional Formatting to set up the rules. Please have a try. If the problem still remains, please provide me with more details so I can help you. Have a nice day.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
Hi, das hilft mir bereits sehr weiter, danke!Gibt es aber auch eine Möglichkeit, die Formel aus Schritt 2 ohne "$"-Zeichen zu verwenden? Das würde das Kopieren der bedingten Formatierung erleichtern...
This comment was minimized by the moderator on the site
What if data is over column and not in a row?
This comment was minimized by the moderator on the site
This is useful, but how would I do the following please. Text is in Col A, the number range is in Col B: when the average has been found using the above method and is thus highlighted, I need the corresponding cell in Col A to also highlight.

Thank you
This comment was minimized by the moderator on the site
Were you able to figure this out? I would also like to know about expanding the format to the remaining row.
This comment was minimized by the moderator on the site
Hi! I am very thankfull to u for this as this solved my problem for a presentation to a client. However I am looking for something more for my future presentations. like when u say highlight 3 closest(n) values i want to highlight them as: 1) the most closest with Green. 2) the least closest in red and the 3) value which is between most and least closest in yellow. Can u please help me to achieve this. As per the example my d2 value is live updating every minute so i want to know where exactly my d2 value lies on scale of a range(eg. Number list). This will add a brand finish to my presentations. Point to note i am using excel 2007 as many of my clients are still using the same. Just to avoid any compatibility issues i avoid latest versions. Thanks in advance and many regards. :)
This comment was minimized by the moderator on the site
An excellent resource for highlighting the closest value. Since the logic is same , won't it work in Google Sheets? Anyway it is not working in Google Sheets. Would be obliged if you could please clarify!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations