跳到主要內容

如何在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用於Excel的 選擇特殊單元格 實用程序可輕鬆找出並選擇給定值的除法範圍內的所有最接近的值。

Excel的Kutools-包括300多個用於Excel的便捷工具。 全功能60天免費試用,無需信用卡! 立即行動吧!

例如,在我們的示例中,我們將偏差值定義為2,給定值是18。因此,我們需要找出並選擇介於 16 (= 18-2) and 20 (= 18 + 2)。 請查看以下步驟:

1。 選擇您要搜索與給定值最接近的值的範圍,然後單擊 庫工具 > 選擇 > 選擇特定的單元格.

2.在打開的“選擇特定單元格”對話框中,
(1)檢查 細胞 在選項 選擇類型 部分;
(2)在 特定類型 部分,單擊第一個下拉列表,然後選擇 大於或等於 從它和類型 16 進入以下框,然後選擇 小於或等於 從第二個下拉列表中鍵入 20 進入以下框。 見左截圖:

3。 點擊 Ok 按鈕以應用此實用程序。 然後將出現一個對話框,向您顯示已選擇了多少個單元格。 您將看到已選擇給定值偏差範圍內的所有最接近的值,如下圖所示:


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

如果您安裝了Kutools for Excel,則可以使用其模糊查找功能輕鬆在Excel中查找給定範圍內最接近的文本字符串。 請執行以下操作:

Excel的Kutools-包括300多個用於Excel的便捷工具。 全功能60天免費試用,無需信用卡! 立即行動吧!

1。 點擊 庫工具 > 發現 > 模糊查詢 在工作簿中啟用“模糊查找”窗格。

2。 在“模糊查找”窗格中,請進行以下配置;
(1)檢查 規定 選項,然後選擇查找最接近的文本字符串的範圍;
(2)檢查 按指定文字查找 選項;
(3)前往 文本 框,然後鍵入您將找到其文本字符串最接近的指定文本;
(4)在 最大字符數 框,請輸入數字。 就我而言,我輸入1;
(5)在 單元串長度至少為 框,請輸入數字。 就我而言,我輸入5;

3。 點擊 發現 按鈕。

現在展開搜索結果,您將看到所有最接近的文本字符串都在列​​表中。 看截圖:


演示:在給定值的偏差範圍內選擇所有最接近的值

Excel的Kutools:超過 300 個方便的工具觸手可及! 立即開始 30 天免費試用,沒有任何功能限制。 現在就下載!

最佳辦公生產力工具

🤖 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 (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