+ Reply to Thread
Results 1 to 7 of 7

Find last MATCH for each row on a 2D running array with ONE "spill" formula

  1. #1
    Registered User
    Join Date
    11-27-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    MS Office 365
    Posts
    42

    Question Find last MATCH for each row on a 2D running array with ONE "spill" formula

    Here I come again with another 2D array formula curveball (at least for me...)

    Below is a short snippet of a particular column within a multi-column table containing a list of stock tickers:

    Data.png

    Then I went through the usual motions to get to a 2D "spill" formula down and across for the above range, which is to TRANSPOSE a UNIQUE list of all tickers, and then put together a cumulative 2D array of said column - which I picture below along with the respective formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Data_*** Array.png

    And when I finally get to the point of reaching my goal, which is to extract the last row number that matches each respective ticker on the transposed list (as pictured below), I'm stuck with a 1D solution using a previously provided BYROW approach from Bo_Ry on a different question I had.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Match_1D_Array_Formula.png

    The above solution again needs to get dragged across columns, and I need a dynamic solution that will stretch down and across since not only the table feed will grow, but also new tickers will for sure come up in the future...

    Any way I could adapt that to my needs?

    Thanks in advance...

    P.S.:
    I've also posted this same question on Microsoft Tech Community.
    HTML Code: 
    Last edited by leolapa; 09-03-2021 at 07:04 PM.

  2. #2
    Registered User
    Join Date
    11-27-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    MS Office 365
    Posts
    42

    Re: Find last MATCH for each row on a 2D running array with ONE "spill" formula

    I came up with my own solution, albeit long and convoluted it sure gets the job done:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I also received a few other solutions on my similar post at the Microsoft Tech Community forum...

    This one makes great use of the MAKEARRAY function and is much shorter and leaner:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This on the other hand, makes use of the recently added MAP function:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Although much shorter, it does require the creation of a couple named formulas as well as named cells/range though:
    Broadcastλ:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    LastMatchλ:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    StockTicker:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Ticker:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And finally another user came up with a pretty clever Power Query code that could work great on larger workbooks:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Find last MATCH for each row on a 2D running array with ONE "spill" formula

    How about

    =LET(c;$C2#;sr;SEQUENCE(ROWS(c));cc;COLUMNS(c);--MID(BYCOL(X1#;LAMBDA(z;CONCAT(TEXT(MOD(SMALL(sr*1000+SEQUENCE(;cc)*(c=z);sr*cc);1000);"00"))));sr*2-1;2))

  4. #4
    Registered User
    Join Date
    11-27-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    MS Office 365
    Posts
    42

    Re: Find last MATCH for each row on a 2D running array with ONE "spill" formula

    Quote Originally Posted by Bo_Ry View Post
    How about

    =LET(c;$C2#;sr;SEQUENCE(ROWS(c));cc;COLUMNS(c);--MID(BYCOL(X1#;LAMBDA(z;CONCAT(TEXT(MOD(SMALL(sr*1000+SEQUENCE(;cc)*(c=z);sr*cc);1000);"00"))));sr*2-1;2))
    Works great, thanks!!!

  5. #5
    Registered User
    Join Date
    11-27-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    MS Office 365
    Posts
    42

    Re: Find last MATCH for each row on a 2D running array with ONE "spill" formula

    Quote Originally Posted by Bo_Ry View Post
    How about

    =LET(c;$C2#;sr;SEQUENCE(ROWS(c));cc;COLUMNS(c);--MID(BYCOL(X1#;LAMBDA(z;CONCAT(TEXT(MOD(SMALL(sr*1000+SEQUENCE(;cc)*(c=z);sr*cc);1000);"00"))));sr*2-1;2))
    Hey Bo_Ry, thanks again for this very nimble solution you provided... but when I tried to apply that to my actual full schedule, which contains more than 100 rows, it won't work because I noticed your solution "resets" the rows count every 100 rows (i.e.: it returns row 42 instead of row 142).

    I tried to fix that by adding a couple more zeroes to your calculation, tested first on my mock up data just to make sure I wouldn't screw up anything, but then when I applied to my real data this reset continues.

    What am I missing here?
    Last edited by leolapa; 09-05-2021 at 11:23 PM.

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Find last MATCH for each row on a 2D running array with ONE "spill" formula

    Try

    =LET(c;$C2#;sr;SEQUENCE(ROWS(c));cc;COLUMNS(c);--MID(BYCOL(X1#;LAMBDA(z;CONCAT(TEXT(MOD(SMALL(sr*1000+SEQUENCE(;cc)*(c=z);sr*cc);1000);"000"))));sr*3-2;3))

  7. #7
    Registered User
    Join Date
    11-27-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    MS Office 365
    Posts
    42

    Re: Find last MATCH for each row on a 2D running array with ONE "spill" formula

    Quote Originally Posted by Bo_Ry View Post
    Try

    =LET(c;$C2#;sr;SEQUENCE(ROWS(c));cc;COLUMNS(c);--MID(BYCOL(X1#;LAMBDA(z;CONCAT(TEXT(MOD(SMALL(sr*1000+SEQUENCE(;cc)*(c=z);sr*cc);1000);"000"))));sr*3-2;3))
    Yes sir, thanks!

+ 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] Extract unique lists of sorted data across columns (2D arrays) with ONE "spill" formula
    By leolapa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-01-2021, 09:58 AM
  2. [SOLVED] Data sorting multiple rows across columns (2D arrays) with only ONE "spill" formula
    By leolapa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-24-2021, 01:40 PM
  3. [SOLVED] Return MAX (or LARGE) for each 2D array's row with only ONE "spill" formula
    By leolapa in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-22-2021, 08:50 AM
  4. Replies: 3
    Last Post: 11-19-2020, 08:30 PM
  5. Replies: 2
    Last Post: 07-24-2017, 02:19 AM
  6. Replies: 7
    Last Post: 04-11-2013, 12:46 AM
  7. [SOLVED] If changed array formula reduce ""\""\""\ - signs to #Missing, will it make ...
    By Maria J-son in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2006, 08:25 AM

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