Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 views
in Technique[技术] by (71.8m points)

Excel - Return multiple column headings based on multiple "x" entries in a row in a table?

If I have a table with various combinations of "x" in the columns of each row, against each row how do I write a formula that would return the column heading for each column where there is an "x". The cells without an "x" are blank, and would not return the column heading.

SO if my columns were called A, B, C and D and there was and x in column B and D only for that reference row, I would get a return of "B,D" as a comma separated string.

Thank you

question from:https://stackoverflow.com/questions/65870627/excel-return-multiple-column-headings-based-on-multiple-x-entries-in-a-row-i

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

With O365 you can use following formula:

=TEXTJOIN(",",1,FILTER(A1:D1,MMULT(COLUMN(A1:C1)^0,--(A2:D4="x"))))

enter image description here

In the MMULT function, the number of columns in the first parameter COLUMN(A1:C1) must correspond to the number of rows in the second parameter A2:D4="x"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...