Search code examples
arraysgoogle-sheetssumgoogle-sheets-formulatranspose

How do you automatically copy a formula across a row if the header contains text?


I have a Google Sheet that transposes a list of items as the headers of the sheet. This list changes frequently +/- which means that the number of column headers (row 2) change frequently. On the first row (under the header) I have a formula that populates the column contents based on the header name. How do I get my formula to only copy to ALL the columns that have a header name and not to the ones that are empty.

Note the empty columns need to be there.

enter image description here


Solution

  • try:

    =ARRAYFORMULA(IF(2:2="",,TRANSPOSE(MMULT(TRANSPOSE(IF(A3:3500<>"", 1, 0)), 
     ROW(3:3500)^0))&" Results"))