We saw in a previous post (here) an outline for a solution which, given a two-dimensional array, potentially containing some empty cells, generated a list of all non-blank entries from that array in a single column.
In that solution the returned entries were listed in an order which is consistent with the entries from an entire row from the original array being returned prior to moving onto those in the next row. The converse, in which entries are returned in a columns-first fashion, is the challenge I would like to set for any readers of this post willing to have a go.
Readers are advised to go through the link to that first solution, if they have not already done so, and either adapt the solution given there to meet this new requirement, or come up with a completely different approach which solves the problem.
To re-cap: given the the 6-by-4 array on the left (assumed to be stored as the Named Range Range1), the previous post gave a solution to generate the entries as per column G.
The entry in cell F1 is derived from the formula:
i.e. counts the number of non-blank cells in Range1.
And the array formula in G1 is:
Your challenge is to come up with a solution which generates the list in column H: the same values as in column G, but this time returned with respect to columns, that is in an order which is consistent with the entries from an entire column from the original array being returned prior to moving onto those in the next column.
Solutions should involve a single formula placed in H1 which, when copied down an arbitrary number of rows, generates the entries as above. The formula should return a blank for all rows to which the formula is copied beyond row 13.
Note also that a set-up which goes through each of columns A to D in turn, i.e. returning non-blanks from one before moving on to the next, is not really the point: it should be borne in mind that the number of columns here is purely arbitrary, and a solution should be able to cope with any number of columns, without the need for the addition of extra clauses to the formula.
If you’re not sure what I mean by this, try making Range1 100 columns wide, not just 4: if you find your solution suddenly requiring another 96 clauses adding to it then you’re probably on the wrong track!
Solution next Sunday. Good luck!