I have a table that has both column headers and row titles. Each cell in the matrix can be empty or not. The actual value is inconsequential. My goal is to look at each row by title and return an array of column headers for which the intersecting cell is not empty.

```
Titles    Col_A    Col_B    Col_C    ...
Row_1                x
Row_2       x                 x
Row_3       x

```

If interested in `Row_1`, I should return `{Col_B}`, or if searching `Row_2` then I should return `{Col_A, Col_C}`.
I have the following formula that return an array of cell values for non-empty cells, but I do not know how to get the column headers from this.

```
=FILTER(XLOOKUP(A2,OtherSheet!A:A,OtherSheet!B:O,""),NOT(ISBLANK(XLOOKUP(A2,OtherSheet!A:A,OtherSheet!B:O,""))))

```

So using the above example, if `A2=Row_1`, the formula above would return `{x}`, or if `A2=Row_2`, `{x,x}`.

Because I know this table is limited to single values (`"FOO"`) I have also tried the formula

```
XLOOKUP("FOO",XLOOKUP(A2,OtherSheet!$A$1:$A$31,OtherSheet!B$2:$O$32),OtherSheet!B$1:$O$1)

```

Which for `A2=Row_2` returns `Col_A` alone rather than an array of all matching values.

If I give the outer XLOOKUP as the first parameter an array (`{"FOO","FOO",...}`) it simply returns the same length array with all values being `Col_A`.