Forum Discussion
Clare1487
Jun 26, 2023Copper Contributor
Returning multiple column headers based on duplicated dates within a row
Hi I have read many similar questions & answers, but none of the replies seem to work with my data. I have a spreadsheet with dates in varying order from left to right and some blank cells within ea...
mtarler
Jun 26, 2023Silver Contributor
OliverScheurich i might recommend using DROP(row,,-1) to make it more easily adapted to different sizes:
=BYROW(AX2:BF19,LAMBDA(row,TEXTJOIN(",",,FILTER($AX$1:$BE$1,DROP(row,,-1)=TAKE(row,,-1),""))))I also moved the alternative "" inside the FILTER but wasn't sure if there was any other reason for the IFERROR ...
Clare1487
Jun 27, 2023Copper Contributor
Hi Thanks for your reply. This did give me column headers in the output cell, but they didn't correctly relate to the cell content of that column (some were blank.) When I changed the formula to include my range it just gives me an error. I'll upload a sample file. I was hoping to be able to find which columns matched that with header S2REV, then use the same principle to use other columns as the reference column and perhaps in future look for the column(s) with a date after the reference column....
- mtarlerJun 27, 2023Silver Contributor
Clare1487 so it might be how you typed the formula in. mine is based on Quadruple_Pawn's and it expects the data to be immediately followed by target so range AX2:BF19 expects the last column to be the target and does not include the header and then $AX$1:$BE$1 is the header of only the data range (i.e. stops at BE)
=BYROW(AX2:BF19,LAMBDA(row,TEXTJOIN(",",,FILTER($AX$1:$BE$1,DROP(row,,-1)=TAKE(row,,-1),""))))- Clare1487Jun 28, 2023Copper ContributorThank you so much for explaining, this is all a learning curve for me! Now that I have the column on the right hand side it is working beautifully. Could the same formula be modified to return the headers of the first date after the target?