• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Extact nearest similar value from data by formula

hii
i have some data as a list in and i want to extract similar nearest data by formula.
any can help me please ?
i want to extact just like 12=14,56=58



12​
14​
19​
56​
58​
202​
508​
 

Attachments

  • similar data extract.png
    similar data extract.png
    9.1 KB · Views: 7
Code:
= LET(
    sorted, SORT(numbers),
    first,  DROP(sorted,-1),
    next,   DROP(sorted, 1),
    paired, HSTACK(first, next),
    diff,   next - first,
    min,    MIN(diff),
    FILTER(paired, diff=min)
  )
 
It's for Excel. If you wanted a GoogleSheets solution, you should have mentioned this in the opening post.

Please provide a sample workbook (attached here if it's for Excel, or a link to an editable copy on GoogleDrive if it's for GoogleSheets).
 
Back
Top