Convert array to string via formula

CodeNinja

Well-known Member
Joined
Feb 18, 2013
Messages
634
I have a series of if/then conditions I need to concatenate... Rather than have a long formula of concatenate(if(a2="fail",a1,""),if(b2="fail",b1,""),......) I would like to do an array formula {=Concatenate(if(A2:R2="Fail",$C$1:$R$1,""))} Unfortunately concatenate only sees the first result in the array... When I evaluate the if then portion, I get {"","",Cell$C$1,"",""...) but the concatenation will not joint them together. I tested this by using the formula {=concatenate({"Yes","No"})} and got Yes as my answer...

Any ideas how to make this work the way I want?

Thanks,

CN.
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

CodeNinja

Well-known Member
Joined
Feb 18, 2013
Messages
634
Nevermind, I just wrote a user defined function that handles this...

Function cCat(rngTest As Range, sCondition As String, rngResult As Range) As String
Dim i As Integer
For i = 1 To rngTest.Cells.Count
If rngTest(i) = sCondition Then
cCat = cCat & rngResult(i) & ", "
End If
Next i
End Function
 

Watch MrExcel Video

Forum statistics

Threads
1,122,214
Messages
5,594,881
Members
413,947
Latest member
gizmolucy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top