跳到主要内容

如何在Excel中查找最接近或最接近的值(数字或文本字符串)?

假设您在一列中有一个数字列表,现在您需要从数字列表中找出与给定值最接近或最接近的值。 你如何解决? 实际上,您可以按照以下步骤在Excel中找到最接近的值或最接近的值。

用数组公式查找最接近或最接近的数字

例如,您在A列中有一个数字列表,现在您将找到与A列最接近的值或最接近的18值。您可以按照以下步骤进行操作:

选择一个空白单元格,然后输入以下公式,然后按 Ctrl + Shift + Enter 钥匙在一起。

=INDEX(B3:B22,MATCH(MIN(ABS(B3:B22-E2)),ABS(B3:B22-E2),0))

请注意: 在这个数组公式中 {=INDEX(B3:B22,MATCH(MIN(ABS(B3:B22-E2)),ABS(B3:B22-E2),0))},

  • B3:B22 是您要查找特定值的范围
  • E2 是要与之比较的搜索值。
注意丝带 公式太难记了吗? 将公式另存为自动文本条目,以供日后再次使用!
阅读全文...     免费试用

使用 Kutools for Excel 轻松选择给定值偏差范围内所有最接近的数字

有时,您可能想要找出并选择一个范围内与给定值最接近的所有值。实际上,我们可以定义一个偏差值,然后应用Kutools for Excel 选择特殊单元格 实用程序可轻松找出并选择给定值的除法范围内的所有最接近的值。

Kutools for Excel-包括300多个用于Excel的便捷工具。 全功能60天免费试用,无需信用卡! 立即行动吧!

例如,在我们的示例中,我们将偏差值定义为2,给定值是18。因此,我们需要找出并选择介于 16 (= 18-2) 以及 20 (= 18 + 2)。 请查看以下步骤:

1。 选择您要搜索与给定值最接近的值的范围,然后单击 库工具 > 选择 > 选择特定的单元格.

2.在打开的“选择特定单元格”对话框中,
(1)检查 手机 在选项 选择类型 部分;
(2)在 特定类型 部分,单击第一个下拉列表,然后选择 大于或等于 从它和类型 16 进入以下框,然后选择 小于或等于 从第二个下拉列表中键入 20 进入以下框。 见左截图:

3。 点击 Ok 按钮以应用此实用程序。 然后将出现一个对话框,向您显示已选择了多少个单元格。 您将看到已选择给定值偏差范围内的所有最接近的值,如下图所示:


使用方便的工具查找最接近或最接近的文本字符串

如果您安装了Kutools for Excel,您可以应用其模糊查找功能在Excel中轻松地从给定范围中找出最接近的文本字符串。请按以下步骤操作:

Kutools for Excel-包括300多个用于Excel的便捷工具。 全功能60天免费试用,无需信用卡! 立即行动吧!

1。 点击 库工具 > 找到最适合您的地方 > 模糊查询 在工作簿中启用“模糊查找”窗格。

2。 在“模糊查找”窗格中,请进行以下配置;
(1)检查 指定 选项,然后选择查找最接近的文本字符串的范围;
(2)检查 按指定文字查找 选项;
(3)前往 文本 框,然后键入您将找到其文本字符串最接近的指定文本;
(4)在 最大字符数 框,请输入数字。 就我而言,我输入1;
(5进 单元串长度至少为 框,请输入数字。 就我而言,我输入5;

3。 点击 找到最适合您的地方 按钮。

现在展开搜索结果,您将看到所有最接近的文本字符串都在列​​表中。 看截图:


演示:在给定值的偏差范围内选择所有最接近的值

Kutools for Excel:超过 300 个方便的工具触手可及! 立即开始 30 天免费试用,没有任何功能限制。 立即下载!

最佳办公生产力工具

🤖 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 (42)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How do we do this if our data is filtered?
This comment was minimized by the moderator on the site
copy the filtered data to a new sheet
This comment was minimized by the moderator on the site
Using the formula how would you return the value next to 17 if there was another column next to number like names. So if 17 is the closest in rang the name next to 17 (John) would be returned?


Example: 18 is nearest to 17 so the return value would be John


Numbers Names
38 Tammy
17 John
20 Amy
This comment was minimized by the moderator on the site
You can use the Approximate match of VLOOKUP function to solve this problem.
=VLOOKUP(E2,A1:B15,2,TRUE)
This comment was minimized by the moderator on the site
I used this formula =INDEX(B3:B22,MATCH(MIN(ABS(B3:B22-E2)),ABS(B3:B22-E2),0)) and it works great. However i have found that where the source number is exactly between two numbers in the range, the lower range number is selected to be the closest.

eg: Searching for the closest number to 9 in the range: 6, 8, 10, 12. It will chose 8 instead of 10. Rounding convention is to round up if exactly half way between. Is there a workaround? Thanks.
This comment was minimized by the moderator on the site
ITS NOT WORKING its #N/A somehow
This comment was minimized by the moderator on the site
Hi DAKOT,
=INDEX(A1:A20,MATCH(MIN(ABS(A1:A20-D1)),ABS(A1:A20-D1),0)) is an array formula, after entering it, please remember to press the Ctrl + Shift + Enter keys together.
This comment was minimized by the moderator on the site
Hi,
im using that formula in finding closest date, it is working.but i want to add condition: closest date that is less than 30 days of the current date (today).it is possible?
Anyone can help please?thank you
This comment was minimized by the moderator on the site
Hi farolito,
How about changing the value you will compare with to =TODAY() in Cell D1?
This comment was minimized by the moderator on the site
Hi, I can get it to work, amazing, BUT not when I input '1' as my 'match_type', instead of the '0' that you used. I want to return values less than or equal to, not just closest to +/-. If I enter 1 instead of 0, it doesn't work. Thoughts on why this might be?
This comment was minimized by the moderator on the site
Great formula -thank you-just a quick question. Anyone know how to highlight the cell that is closest in the match so in long lists it is easy to find??
This comment was minimized by the moderator on the site
If you have the row number from the formula above then you could set a conditional formatting rule on the search array to highlight a cell if it lies on that row.
This comment was minimized by the moderator on the site
It does not work for me! Excel says that there is an error :(
This comment was minimized by the moderator on the site
My bad This will look for all nearest date to today in column d =LARGE(D:D,COUNTIF(d:D,">="&TODAY())) http://WWW.excelireland.com
This comment was minimized by the moderator on the site
Hi, I tried the above formula. however, it is giving me a #N/A. 1. Copy pasted the range from A2 to A43. 2. Formula given was : =INDEX(A2:A43,MATCH(MIN(ABS(A2:A43-H1)),ABS(A2:A43-H1),0)) 3. Press control +Shift +enter Can anybody help me as to what wrong I am doing. :(
This comment was minimized by the moderator on the site
Replace the " , " separator for " ; "
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations