+ Reply to Thread
Results 1 to 41 of 41

Re: Extract subarray from table column based on criteria matched-structure table reference

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Hi,

    i want to add into named range from dynamic table where Criteria is "Yes" or "No".

    So for named range = "ResultNo" i should have array : {1111,2222,3333} and for named range = "ResultYes" i should have : {4444,5555,6666,7777} in Formulas Manager from dynamic table.
    How can i achive this in the simplest way?

    Best,
    Jacek

    Screenshot_16.png
    Attached Files Attached Files
    Last edited by jaryszek; 08-22-2018 at 04:55 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: The most simple array formula with where clause

    ResultYes: =TEXTJOIN(",",TRUE,IF(t_MaxMemory[Environment]="Yes",t_MaxMemory[Offered],""))
    ResultNo: =TEXTJOIN(",",TRUE,IF(t_MaxMemory[Environment]="No",t_MaxMemory[Offered],""))

    Requires xl2016 in order to use the TEXTJOIN function
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: The most simple array formula with where clause

    wow thank you.

    What about array formula and excel 2010 ?

    Best,
    Jacek

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: The most simple array formula with where clause

    You would need to create a UDF (user defined function) to concatenate text.

  5. #5
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: The most simple array formula with where clause

    thank you Andy.

    I do not want to this.
    Maybe i will use helpel columns to get specific values with condition.

    Can anybody help with writing array formula for this?
    Best,
    Jacek

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: The most simple array formula with where clause

    and i saw that this textjoin is not treated like array - this is text joined...
    This is not what i mean here...

    I want to use this in other formulas as array of values...

    Best,
    Jacek

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: The most simple array formula with where clause

    In other words:
    I need extract subarray from table column based on criteria matched in the same table.

    Best,
    Jacek

  8. #8
    Forum Contributor
    Join Date
    10-30-2003
    Location
    Singapore
    MS-Off Ver
    Excel 2019
    Posts
    197

    Re: The most simple array formula with where clause

    Maybe…………….

    1] G4,

    =OFFSET(A2:A10,MATCH("No",A2:A10,0)-1,1,COUNTIF(A2:A10,"No"))

    2] I4,

    =OFFSET(A2:A10,MATCH("Yes",A2:A10,0)-1,1,COUNTIF(A2:A10,"Yes"))

    p.s. press F9 to view the result

    Regards
    Bosco
    Last edited by Bosco; 08-21-2018 at 10:05 AM.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: The most simple array formula with where clause

    Bosco - is that amendable to take account of a more realistic example where the Yes/No responses are not/cannot be sorted?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  10. #10
    Forum Contributor
    Join Date
    10-30-2003
    Location
    Singapore
    MS-Off Ver
    Excel 2019
    Posts
    197

    Re: The most simple array formula with where clause

    Quote Originally Posted by Glenn Kennedy View Post
    Bosco - is that amendable to take account of a more realistic example where the Yes/No responses are not/cannot be sorted?
    If data are unsorted (or sorted), try to use :

    =INDEX($B$1:$B$10,N(IF(1,AGGREGATE(15,6,ROW($B$1:$B$10)/($A$1:$A$10="No"),ROW(INDIRECT("1:"&COUNTIF($A$1:$A$10,"No")))))))

    or,

    =INDEX($B$1:$B$10,N(IF(1,AGGREGATE(15,6,ROW($B$1:$B$10)/($A$1:$A$10="Yes"),ROW(INDIRECT("1:"&COUNTIF($A$1:$A$10,"Yes")))))))


    Regards
    Bosco

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: The most simple array formula with where clause

    Brilliant. I had been playing with this:

    =SMALL(IF(A2:$A$10="No",$B$2:$B$10),ROW(INDIRECT("1:"&COUNTIF($A$2:$A$10,"No"))))

    which returns the correct values in an array (F9), but which cannot be used in a DV list. To preserve what is left of my sanity.... why does it not work in the DV list??

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: The most simple array formula with where clause

    I had too much faith in your solution (which I looked at, but did not evaluate!!), Bosco... it returns the same error message in the DV list as my effort.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: The most simple array formula with where clause

    Obviously, it's INDIRECT that's mucking it up... but I cannot get a workaround to work for me...

  14. #14
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: The most simple array formula with where clause

    so this is working only when conditionas are in order?

    Best,
    Jacek

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: The most simple array formula with where clause

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  16. #16
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: The most simple array formula with where clause

    Hi FDibbins,

    thank you.

    Please change the title for:

    "Extract subarray from table column based on criteria matched"

    Best,
    Jacek

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: The most simple array formula with where clause

    I explained in my post how you can change your title

  18. #18
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched

    Ok thank you done it.

    Returning to the topic, Bosco, your formula only working when we have sorted table?

    I changed order and this is working like a charm.
    Can you help me with understanding this function?

    Please Login or Register  to view this content.
    Mainly this one:

    Please Login or Register  to view this content.
    Result is:

    Please Login or Register  to view this content.
    How this is working?

    Why Glenn did you wrote that there is an error?

    And one more thing - this is only working when i have table in first row. What if i will move table to assume 5th row? It would be not working...

    Best,
    Jacek
    Attached Files Attached Files
    Last edited by jaryszek; 08-22-2018 at 03:09 AM.

  19. #19
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched

    I am away from my PC. Bosco's formula works fine. But. I assumed that yiu wanted to use this for data validation, given your previous threads. I could not get it to work in DV. Did you get it working, or did yiu want the array for another purpose? Can't access your file at the moment.

  20. #20
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched

    Hi Glenn.

    thanks!

    Formula is working fine but this should refer to dynamic table addresses not cell addresses.
    This is not working where you move your table into another place.

    I want to use it in formula as array to look within.
    So i want to have named range and put this array into it.

    Best,
    Jacek

  21. #21
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Extract subarray from table column based on criteria matched-structure table reference

    @Glenn,

    A DV list source must be a delimited string or a single column/row range. It cannot be an array, unfortunately.
    Rory

  22. #22
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Anybody?

    This index function would be awesome if we could point into dynamic table reference row number.
    Some array with index and match to refer to the exact row number...

    Please help,
    Best,
    Jacek

  23. #23
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    See rorya's comment and my opinion, previously expressed on one of your other threads. You can't do it. At least not directly. If you do want to select choices for a DV list, then you need to assemble the "approved list" in another place as a contiguous set of "approved items" and use that for your DV.

    It's just a "feature" of excel that has never been addressed.

    Do you know how to do what I have suggested?

  24. #24
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Glenn,

    thank you very much.
    I want to have named range - not DV list for it. So named range with array from dynamic table. But still if you can not do this at once - it is ok.

    Please help with this helper column (the easiest way),
    still i am not feeling these array formulas.

    Best,
    Jacek

  25. #25
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Not sure if I follow you... What do you want to do with the array if/when you have it??

  26. #26
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Hi,

    i want to get 2 separated lists into order to assign them into named range:

    Screenshot_17.png

    Thank you,
    Best,
    Jacek

  27. #27
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Yes... but. I asked what you wanted TO DO with the named range... You didn't answer.

    A guess. With No and Yes in F1 and G1:

    =IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW(t_MaxMemory[[Environment]:[Environment]])/(t_MaxMemory[[Environment]:[Environment]]=F$1),ROWS(F$2:F2))),"")

    coped across and down. Then use this for the named range (similar for column G):

    =OFFSET(Sheet1!$F$2,,,SUMPRODUCT(--(LEN(Sheet1!$F$2:$F$11)>0)))
    Attached Files Attached Files

  28. #28
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    A sorry Glenn,

    and thank you. I want to use this within formula. To have vlookup within named range.

    Ok,
    a little explanation here:

    this sum product: how this is working here? what is "--" as array?
    And why values greater then 0 is only summed?

    And about aggregations function.

    How this is working step by step in details?:

    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    ?

    thank you,
    Best,
    Jacek

  29. #29
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    ROW(t_MaxMemory[[Environment]:[Environment]]) return the row number where the criterion is met.

    (t_MaxMemory[[Environment]:[Environment]]=F$1) this is the criterion. where t_MaxMemory[Environment] is "No"

    The doubling up of the [Environment] bit has the same function as the $ in normal formulae: locks the column.

    ROWS(F$2:F2) a counter, starts at 1 and increments by 1 per row. It feeds into INDEX($b:B,AGGREGATE(15,6... which returns the values from column B that meet the yes/No criterion in ascending row number order.

    -- coerces the numerical responses from the LEN bit into TRUE or FALSE.

  30. #30
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    oo thank you very much!

    awesome you explained it very well.

    ROW(t_MaxMemory[[Environment]:[Environment]]) return the row number where the criterion is met.
    one more thing.
    So to find criterion you are using "/" sign? how this is working?

    Best,
    Jacek

  31. #31
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Yes. / works the same way as in LOOKUP.... The criteria begin here...

  32. #32
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Hi Guys,

    i have to refresh topic.

    I moved table in another place in workbook and now i have error.

    I have to locate Row number for table and use it somehow with this aggregation function.

    I do not know how this aggregatio nfunction works when you have table in A1 cell.
    YOu have row {1,2,3} there - how this is working ?

    This function:

    Please Login or Register  to view this content.
    when table is moved is not working.

    Please help,
    Best,
    Jacek
    Attached Files Attached Files

  33. #33
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    The results (F2:G11) seem fine to me. However if you are referring to the error message in K9.... then you will need to explain what you HOPED it would do. I can't tell what your intention was....

  34. #34
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Hi Glenn,

    i created new Sample.

    In column M there is a formula which i created to create DV list:

    Please Login or Register  to view this content.
    what is expected result?

    To have Data Validation list with this formula. To see within DV only
    Please Login or Register  to view this content.
    without creating helper columns.

    I created with this formula named ranged and tried to use it within DV list but i have an error (during calculations there is an error).

    Please help,
    Jacek
    Attached Files Attached Files

  35. #35
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Extract subarray from table column based on criteria matched-structure table reference

    In a named formula, INDIRECT needs a sheet name.

    Edit: actually, that's not necessary if you are using it as a data validation list. It is necessary for a chart source. Ignore me.
    Last edited by rorya; 08-29-2018 at 10:17 AM.

  36. #36
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Please post a sheet with the formula in place. I can't even get it to produce an error (; and , issues, I think).

  37. #37
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Glen,

    you have formula in M19 cell, sheet1. And Also as named ranged CheckingTest.

    What i need i want to have array of list as i wrote,

    Best,
    Jacek

  38. #38
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    So. I am going in ever decreasing circles trying to figure out EXACTLY what you want. L15 (my formula) and L17 (your adaptation of it) BOTH produce and an array of ={4444;5555;7777}....

    See sheet.
    Attached Files Attached Files

  39. #39
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Hi Glenn,

    thank you.

    Your formula is working only as my formula - on sheet. Try to move it to DV list...(as named ranged for example).
    You will get an error.

    So this want i achieve here - to input this formula into DV list and make it working...

    Best,
    Jacek

  40. #40
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Re-read Post 23. You can't.

  41. #41
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Extract subarray from table column based on criteria matched-structure table reference

    Ahh it is a pity...

    Best,
    Jacek

+ 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. Simple array formula
    By cwurfel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-24-2015, 12:55 PM
  2. [SOLVED] Trouble with Simple Array Formula
    By pugsly8422 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-09-2014, 02:57 PM
  3. Solve the Simple Array Formula
    By swisssri in forum Excel General
    Replies: 4
    Last Post: 09-25-2013, 07:44 AM
  4. [SOLVED] Why the simple array formula is wrong?
    By billj in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-12-2013, 10:40 AM
  5. simple array formula
    By jasonanthony in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-21-2008, 01:23 PM
  6. Simple array formula not working
    By alecabral in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-21-2007, 11:59 AM
  7. Array Formula Help -IF / Else clause?
    By Jay in forum Excel General
    Replies: 4
    Last Post: 08-15-2006, 02:30 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