跳到主要内容

如何在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

Tips:如果您要突出显示最接近给定值的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 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
=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