Goldmuskhex
Goldmuskhex

Reputation: 3

Check for condition in row, then print column value

I need to check through a number of column's in Excel. The Columns are filled with 1's & 0's. If a 1 is found then I need to print the value of the header column. There can be multiple 1's appearing in each row which is 5 columns wide.

+---+----+----+----+----+----+---------+
|   | A  | B  | C  | D  | E  | RESULTS |
+---+----+----+----+----+----+---------+
| 1 | R1 | R2 | R3 | R4 | R5 |         |
+---+----+----+----+----+----+---------+
| 2 | 1  | 0  | 0  | 0  | 1  | R1,R5   |
+---+----+----+----+----+----+---------+
| 3 | 0  | 1  | 0  | 0  | 0  | R2      |
+---+----+----+----+----+----+---------+
| 4 | 0  | 0  | 1  | 1  | 0  | R3,R4   |
+---+----+----+----+----+----+---------+

I have been trying various Vlookup functions however I can only get one result per a line. Not two or three.

The formatting of the output doesn't matter as much. As long at the output is unique to the value then it's fine.

Upvotes: 0

Views: 488

Answers (1)

Gangula
Gangula

Reputation: 7352

Yo can get this done using an Array formula. The formula you need to use is : =TEXTJOIN(", ",TRUE,IF(A2:E2=1,$A$1:$E$1,""))

Note: Please note that this is an array formula. So after entering the formula you should be hitting "CTRL+SHIFT+ENTER" NOT "ENTER" TextJoin

Upvotes: 1

Related Questions