I am trying to find the VSTACK for any number of sequences that can be formulated as:
sequence(to_ - from_ + 1) + (from_ - 1)
where column headings to_ and from_ represent the start and end points of respective sequences. For instance, consider the following table of start and end points (from_, to_ resp.):
Example input/output and illustrating possible (albeit sub-optimal in relation to desired/robust soln for Q in hand)
Input
Given this, the desired output should vertically stack 32,46,95, and 45 (comprising sequences with one element each) on top of the (vertical) sequence ranging 48,49,..,57, and likewise for 65,66,..,90.
Output
This would give an output as follows:
The manual way would look something like this:
=VSTACK(SEQUENCE(f2-e2+1)+e2-1, SEQUENCE(f3-e3+1)+e3-1 , … , SEQUENCE(f7-e7+1)+e7-1))
Notes:
Note: this is specific to Office 365 compatible versions of Excel; no interest in helper functions, or soln involving VB, Python in Excel/Advanced Formula Editor add-ins etc.
For reference, I have reviewed questions marked as 'similar' - these did not seem to be readily adaptable to the question in hand:
I have a plausible solution but it lacks parsimony, hoping someone is aware of a more tractable method (still fixing /tweaking so can share for possible refinement as req.).
Related (but adequately different) Qs reviewed
- This Q (top soln goes to hometown, courtesy @JvdV as of present posting)
- Cells already comprise concatenated lists with with suitable delimiter
- Direct application infeasible given when a series of sequences should necessitate the ByRow/LAMDBA duet or similar - further complicating matters
- Other solns utilized VB or were 'static' (i.e. similar to 'long method' above)
- Here is another variation - courtesy @MrExcel MVP
- clearly the format/set up is completely different with disjoint lists that appear to lend themselves to the 'long/manual' method - i.e. adding another 'dynamic list' requires manually updating the function to reference the appropriate 'added range/dynamic list)
SuperUser here appears to have what I'm looking for with toCol for range of arrays, yet does not seem to work / after some adaptation, Q in hand
Chat-GPT didn't solve either, for interest's sake it did propose reduce function which hadn't occurred to me.
Conclusion: popularized techniques appear well-suited to cases where arrays do not first need to be created, i.e. 1 & 3 have these as a given already, in my case, these need to be created.
Use Case
Various advantages RE: data cleaning/analysis and preparation; e.g. in my case I want to reference all Unicode values that produce undesirable characters using Unichar; for the purpose of assimilating the necessary data for analysis.




Perhaps something along the lines of using
TOCOL()function while doing aBOOLEAN LOGICcomparison:_Data--> Variable to store the dataset,_To--> Variable is the end of each start data,NOfRows--> Variable to get the max value from the range,Boolean Logicbetween the_NOfRowswith the_From&_Toif the criteria returnsTRUE, it will give_NOfRowsand if not returns#N/Awhich is parsed usingTOCOL();s function 2nd parameter as well using to stack vertically.Bit shorter version of the above:
ADDENDUM: One doesn't needs a
LAMBDA()recursive helper function for the above question, as well, if someone makes such basic typos even when entering manually then could use the following, however one shouldn't do such irregular/random typos, to increase # of functions(too many functions to play makes excel to run slow, slower, slowest.....).Using
LAMBDA()helper function calledMAKEARRAY()Using
MAP()