Convert array to string via formula

CodeNinja

Well-known Member
Joined
Feb 18, 2013
Messages
644
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.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

CodeNinja

Well-known Member
Joined
Feb 18, 2013
Messages
644
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,156
Messages
5,835,703
Members
430,380
Latest member
Psalmysam

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