+ Reply to Thread
Results 1 to 6 of 6

Binary search and return all matches as an array

  1. #1
    Registered User
    Join Date
    03-28-2016
    Location
    England
    MS-Off Ver
    Microsoft 365 MSO (Version 2306 Build 16.0.16529.20100) 64-bit
    Posts
    2

    Binary search and return all matches as an array

    The last argument in XLOOKUP allows performing a binary search but XLOOKUP only returns one match.
    IF(value=lookup_array,return_array,"") returns all matches in an array but is slow on large lookup ranges/does not do a binary search.

    Would anyone know a fomula - or combination of - that both does a binary search on a sorted range and return all matches as an array?

    Thanks in advance!

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Binary search and return all matches as an array

    crossposted: https://www.mrexcel.com/board/thread...array.1241249/

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this.

    I have added the crosspost reference for you today. Please comply with this and all our rules in the future

    However, if you continue to crosspost, you can expect to have your thread BLOCKED until you update it yourself.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Binary search and return all matches as an array

    In Excel 2013 is XLOOKUP not available. Which Excel are you using now? If you want to check this, please click in Excel on your account name and then Office user info. Probably it is 2021 or 365.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Binary search and return all matches as an array

    Fast answers need clear examples.
    Please post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results.
    Instructions, see yellow banner at the top of this page.

  5. #5
    Registered User
    Join Date
    03-28-2016
    Location
    England
    MS-Off Ver
    Microsoft 365 MSO (Version 2306 Build 16.0.16529.20100) 64-bit
    Posts
    2

    Re: Binary search and return all matches as an array

    Hi HansDouwe,

    I did create the same post on mrexcel.com (I'll mention having cross-posted if I cross-post again) and have got a response:

    =INDEX(returned_array,SEQUENCE(COUNTIFS(lookup_array,lookup_value),,XMATCH(lookup_value,lookup_array,0,2)))

    But thank you for responding

  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Binary search and return all matches as an array

    Thanks for sharing the solution and updating your profile.

    If this solution takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.
    Last edited by HansDouwe; 07-15-2023 at 09:16 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] return all matches to index to return array for sumproduct
    By nossona in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-20-2021, 09:43 AM
  2. [SOLVED] Partial matches for a teext string being used to search an array
    By Brycicle in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2018, 04:50 PM
  3. Search a table with multiple search inputs and return all matches
    By JDI in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-16-2014, 12:23 PM
  4. Search array and highlight array matches
    By ricklou in forum Excel General
    Replies: 3
    Last Post: 12-19-2012, 02:29 PM
  5. Search and return address for all matches
    By ElmerS in forum Excel General
    Replies: 13
    Last Post: 02-14-2010, 06:11 PM
  6. Search using a value that can return multiple matches
    By fg4432 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-07-2007, 10:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1