This is an extension to a question I previously asked and had answered Populate rows on different sheet based on cell value on other sheet
I have a master spreadsheet which contains all subjects e.g.
If value in column D is 'TRUE' I wish to populate row on second sheet with the first three columns (cells in red are copied through, cells in black manually entered.
The solution given in the original question works perfectly, i.e. =FILTER(A2:C4,D2:D4=TRUE)
I would now like to enter additional rows to the second sheet, based on the value in column F. If column F is False, I would like an additional row with the first three columns repeated.
This would continue to repeat if 'FALSE' was entered again in column F.
Ideally this would be automated (e.g. by value in column F or similar), but if this is not possible, is there a way to achieve this manually whilst keeping the original FILTER function working?
To avoid your new inputs (column F) modifying your first array result, I would recommend using an intermediate sheet. So:
=FILTER(A2:C4,D2:D4=TRUE)
in A2 (as above)In Sheet3, add column headers as above in row A. Additionally, add an 'Offset' column (column G) and a single cell in (say) J1 which is the total row count of your first result. One simple method:
=COUNTA(Sheet2!A:A) - 1
(-1 to exclude headers)Additionally, set G2 (i.e. the first 'Offset' cell) to 1.
Now configure row 3 as follows (we use row 3 so you can copy 'up' to row 2, except for the 'Offset' column, as well as down to the maximum plausible extent of your range):
(You can copy A3 across to B3 and C3, because of the relative row references.)
Now, as stated, copy row 3 down as far as needed, and A3:C3 up to A2:C2 (but leave G2 hard-coded to 1).
You should find that by entering TRUE or FALSE in column F, the range resizes as you require.
You must still work downwards, otherwise any previously entered values in columns D and E (below your current working cell) will become misaligned.
Here is an illustration of Sheet3 to help:
Here is an animated GIF to illustrate:
And here is a link to a (read-only) Google Sheet which illustrates the behaviour.
You might of course need to adapt this for your needs by adding error handling etc.