Dynamic Expand List

2 followers
0
Avatar

I have a Transactions LIST column with varying values. 

 

I have a SampleSize INTEGER column with values based on a lookup sheet. 

 

I am trying to pull out the number of list elements based on my SampleSize column. 

 

I am doing this for static value with the following to extract the first two however, sometimes it is more, sometimes it is less. 

LIST(LISTELEMENT(#Transactions;0);(LISTELEMENT(#Transactions;1)))))

 

How do I extract list elements in this scenario?

 

Thank you!

 

 

 

 

Matthew Burns

3 comments

  • Avatar
    Konsta Danyliuk

    Hello Matthew.
    May I ask you to provide a few records sample of the initial data and the final result you are looking for, please. 

    0
  • Avatar
    Matthew Burns
    Transactions(LIST) SampleSize(INT) Example Result(LIST)
    anise, basil, caraway, cilantro, chamomile, dill 2 anise, basil
    cilantro, chamomile, dill, fennel, lavender, lemon Grass 3 cilantro, chamomile, dill
    anise, basil, caraway, cilantro, chamomile, dill 1 anise
    anise, fennel, lavender, parsley, rosemary 2 anise, fennel
    0
  • Avatar
    Konsta Danyliuk

    Hello Matthew.
    Thank you for the sample.

    I guess in this case you could use SUBLIST  function - SUBLIST(<Initial LIST>;<Start from the element>;<Length>).

    SUBLIST(#Transactions;0;#SampleSize) -  which means Create a new list from Transactions > Start from Transactions first element > include SampleSize elements of the initial Transactions list.

    0
Please sign in to leave a comment.