I have this data:

Name 1 2 3 4
Bob X X X
Jim X
Ned X X

I need it to look like this:

Name Values
Bob 1,3,4
Jim 3
Ned 1,4

I found a following formula, which works well for the first column. But I don't know how to customize to add the possibilty of more than one item in the list.
=IFERROR(IF(SEARCH("*X*",H2,1),"1"),"No")

Can you suggest a formula?