# Join column headers and texts in rows, when the cells are not empty



## Rainbow_P (Dec 28, 2022)

Good day!


Raw data as in columns A, B, C.

A way is needed to join the column header and texts in rows, when the cells are not empty.

I am currently using TEXTJOIN("&",TRUE,"Name: "&A2,"Gender: "&B2,"Area: "&C2) in D2, but it includes the header when the cells are empty.

How can I achieve the results sampled in column E?

Thank you.


----------



## mohadin (Dec 28, 2022)

Hi
Try

```
=TEXTJOIN("&",TRUE,IF(A2<>"","Name:"&A2,""), IF(B2<>"","Gender:"&B2,""),IF(C2<>"","Area:"&C2,""))
```
Or 

```
=TEXTJOIN("&",TRUE,IF(A2<>"",$A$1&":"&A2,""), IF(B2<>"",$B$1&":"&B2,""),IF(C2<>"",C1&":"&C2,""))
```


----------



## mohadin (Dec 28, 2022)

```
=TEXTJOIN("&",TRUE,IF(A2<>"",$A$1&":"&A2,""), IF(B2<>"",$B$1&":"&B2,""),IF(C2<>"",$C$1&":"&C2,""))
```


----------



## Rainbow_P (Dec 28, 2022)

mohadin said:


> ```
> =TEXTJOIN("&",TRUE,IF(A2<>"",$A$1&":"&A2,""), IF(B2<>"",$B$1&":"&B2,""),IF(C2<>"",$C$1&":"&C2,""))
> ```


thank you, @mohadin !


----------



## mohadin (Dec 29, 2022)

You are very welcome
And thank you for the feedback
Be happy and safe


----------

