+ Reply to Thread
Results 1 to 2 of 2

extract only cells with data from a specific row in a 2D range and return it as an array

  1. #1
    Registered User
    Join Date
    01-09-2020
    Location
    Jeddah, KSA
    MS-Off Ver
    2013
    Posts
    1

    extract only cells with data from a specific row in a 2D range and return it as an array

    6fb924a9-b464-454a-9551-67336372547d.jpg

    I have a 2D-range of 8 rows by 6 columns say L15:Q22
    each row is 6 cells wide.. some cells contain text (colored in the picture above) and others are empty (no color).
    cells with text are all to the left, while the empty cells are to the right as in the picture attached.

    I have an extra column to the left of the 2D-range to use for lookup of the row number ( row selector ). I use this column cells in a dropdown menu for the user to select a value.

    my objective is, when a user selects a value (which corresponds to a specific row in the 2D-range), I want to be able to get a variable length array containing only the cells with text from that specific row in the 2D-range .. i need this output array as an intermediary product to use in another formula somewhere else

    I managed to get the relative row number of desired data in the 2D-range using match function match(Selector_Column, dropdown_menu_value,0)

    then I used index to return the whole row with 6 cells as an array of 6 elements that contains text (corresponding to cells with data) and zeros ( for empty cells). The formula looks like this index(2D_range,result_of-match_above,0)

    and the result i get is a fixed-size 1 by 6 array that looks like this
    {"M4-item1","M4-item2","M4-item3",0,0,0}

    my question is .. how can i get a smaller/filtered array of the above output array that contain only text, using index/match preferably with other formulae like row/column .. i.e .. the output should be an array that looks like this

    {"M4-item1","M4-item2","M4-item3"} without the empty/zero elements

    any ideas ?
    Last edited by agadir; 12-01-2021 at 02:41 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: extract only cells with data from a specific row in a 2D range and return it as an arr

    =OFFSET(B1,result_of-match_above,0,1,COUNTIF(OFFSET(B1,result_of-match_above,0,1,6),"?*"))

    Try that. If it doesn't work then please attach an actual file. It's easier than attaching a screenshot, and we can test with it. See yellow banner at the top of the page.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. How to return an array of non blank cells from a range
    By OmarQA in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-21-2019, 05:26 AM
  2. Extract 1 row of an array into a range of cells
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-02-2015, 06:42 PM
  3. [SOLVED] Extract the data within the specific date range
    By nth34 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-03-2015, 09:32 PM
  4. Replies: 6
    Last Post: 07-26-2012, 06:34 PM
  5. Macro to extract data from multiple workbooks, specific sheet, specific cells
    By crissandraauree in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2012, 03:54 PM
  6. Replies: 4
    Last Post: 05-02-2006, 11:00 AM
  7. Return a cell value based on specific combinations of cells in an array
    By rmcnam05 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-10-2005, 11:05 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