You need to add a custom function in Excel. You can add using the edit macro option in excel. Then use the below code in the macro window.

Function ConCatRange(C1 As Integer) As String
Dim CellBlock As Range
‘CellBlock = x1: x2
Dim cell As Range
Dim sbuf As String
‘CellBlock = CellBlocks
Set CellBlock = Range(“A” & C1 & “:A” & C1 + 23)
For Each cell In CellBlock
If Len(cell.Text) > 0 Then sbuf = sbuf & cell.Text & “,”
Next
ConCatRange = Left(sbuf, Len(sbuf) – 1)
End Function

Then you can use this function in the cell where you want to change the row data in cell seperated by comma.