Hi,
Try,
In A3 and copied down,
=IF(ROW(A1)-ROW($A$1)+1COUNTIF($A$2:$D$2,"x"),"",INDEX($A$1:$ D$1,SMALL(IF($A$2:$D$2="x",COLUMN($A$2:$D$2)),ROW( A1)-ROW($A$1)+1)))
Or if you want the results in one cell,
=SUBSTITUTE(aCONCAT(IF(A2:D2="x",A1:D1),","),",Fal se","")
Confirm with Ctrl+Shift+Enter.
ACONCAT is a UDF.
Code:
--------------------
Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant
If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If
aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function
--------------------
HTH
--
Krishnakumar
------------------------------------------------------------------------
Krishnakumar's Profile:
http://www.excelforum.com/member.php...o&userid=20138
View this thread:
http://www.excelforum.com/showthread...hreadid=465642