[TABLE="class: MsoNormalTable, width: 2"]
<tbody>[TR]
[TD="width: 80, bgcolor: transparent"] xxx<o
></o
>
[/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[TD="width: 80, bgcolor: transparent"]
<tbody>
[TD="width: 85, bgcolor: white"]<!--[endif]--><!--[if !mso]-->
<tbody>
[TD="bgcolor: transparent"]<!--[endif]-->
<!--[if !mso]-->
[/TD]
</tbody>
<!--[endif]--><!--[if !mso & !vml]-->
<!--[endif]--><!--[if !vml]-->
[/TD]
</tbody> [/TD]
[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] xx<o
></o
>
[/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] x<o
></o
>
[/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] <o
></o
>
[/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] xx<o
></o
>
[/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[TD="width: 80, bgcolor: transparent"] [/TD]
[/TR]
</tbody>[/TABLE]
Col A col B colC<o
></o
>
Col A and Col B can be variable length columns (but they arethe same size)<o
></o
>
I need to perform a logical OR on col A & B (whichgenerates Col C). I want to take the output of the Logical OR (col C) andconcatenate all the non-blank cells separated by a delimiter (a space for thisexample). So the final result is a single cell with the contents “xxx x xx”which I’ll call the ANSWER<o
></o
>
Since this is part of a user form I don’t want to generateCol C in the spreadsheet. I want it to be virtual with only a single cell result(hence it either needs to be a cell formula or a VBA function). I can do thiswith a cell formula using the concatenate function but for large columns, thecell formula won’t fit as it takes too many characters. I have a routine thatcan take a range of variable type data that will remove the blank cells andgenerate the ANSWER. Here it is: <o
></o
>
<o
></o
>
Function ConCat(Delimiter As Variant, ParamArrayCellRanges() As Variant) As String<o
></o
>
Dim CellAs Range, Area As Variant<o
></o
>
IfIsMissing(Delimiter) Then Delimiter = ""<o
></o
>
<o
> </o
>
For EachArea In CellRanges<o
></o
>
IfTypeName(Area) = "Range" Then<o
></o
>
For Each Cell In Area<o
></o
>
If Len(Cell.Value) Then ConCat = ConCat & Delimiter & Cell.Value<o
></o
>
Next<o
></o
>
Else<o
></o
>
ConCat = ConCat & Delimiter& Area<o
></o
>
EndIf<o
></o
>
Next<o
></o
>
ConCat =Mid(ConCat, Len(Delimiter) + 1)<o
></o
>
End Function<o
></o
>
<o
></o
>
I can generate Col C with this formula {=IF((B1:B5=1),IF((A1:A5)="","",(A1:A5)),""))}<o
></o
>
If I use the ConCat function on Col C, {=concat(“ “,C1:C5)}results in the ANSWER “xxx x xx”<o
></o
>
If I type the values of ColC into the ConCat function{=concat(“ “,”xxx”,””,”x”,””,”xx”) I get the ANSWER<o
></o
>
However if I combine the two to do this in 1-step:<o
></o
>
{=concat(" ",IF((B1:B5=1),IF((A1:A5)="","",(A1:A5)),""))}I get #VALUE! Error<o
></o
>
Looking at the debugger, the resultant of the above IF statementsthat passes the values to ConCat is exactly {=concat(“ “,”xxx”,””,”x”,””,”xx”)which then evaluates to the #VALUE! Error. What is happening? Why won’t itwork?<o
></o
>
Some clues from spending a lot of debugging time. TheCaonCat function bombs at the step in yellow when it is trying to concatenate thevariant variable AREA (which TypeName (AREA) says is a string. Apparently theIF statements when parsed into the input to ConCat are placed into AREA as amulti-dimensional Array and it is not compatible with concatenate. The othercalls , {=concat(“ “,C1:C5)} and {=concat(“ “,”xxx”,””,”x”,””,”xx”) are parsedas individual cells and loop through one at a time. The combined function istrying to do it all in a single pass and not one cell at a time. <o
></o
>
Anyone have any ideas on how to fix this?<o
></o
>
Thanks<o
></o
>
mark<o
></o
>
<o
> </o
>
<tbody>[TR]
[TD="width: 80, bgcolor: transparent"] xxx<o


[/TD]
[TD="width: 80, bgcolor: transparent"]
1<o
></o
>


[TD="width: 80, bgcolor: transparent"]
<!--[if gte vml 1]><v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"> <v:stroke joinstyle="miter"/> <v
ath gradientshapeok="t" o:connecttype="rect"/> </v:shapetype><v:shape id="Text_x0020_Box_x0020_2" o:spid="_x0000_s1026" type="#_x0000_t202" style='position:absolute;left:0;text-align:left; margin-left:-3.35pt;margin-top:-53.9pt;width:46.8pt;height:49.8pt;z-index:251661312; visibility:visible;mso-wrap-style:square;mso-width-percent:0; mso-height-percent:0;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0; mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0; mso-position-horizontal:absolute;mso-position-horizontal-relative:text; mso-position-vertical:absolute;mso-position-vertical-relative:text; mso-width-percent:0;mso-height-percent:0;mso-width-relative:margin; mso-height-relative:margin;v-text-anchor:top' o:gfxdata="UEsDBBQABgAIAAAAIQC75UiUBQEAAB4CAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbKSRvU7DMBSFdyTewfKKEqcMCKEmHfgZgaE8wMW+SSwc27JvS/v23KTJgkoXFsu+P+c7Ol5vDoMTe0zZBl/LVVlJgV4HY31Xy4/tS3EvRSbwBlzwWMsjZrlprq/W22PELHjb51r2RPFBqax7HCCXIaLnThvSAMTP1KkI+gs6VLdVdad08ISeCho1ZLN+whZ2jsTzgcsnJwldluLxNDiyagkxOquB2Knae/OLUsyEkjenmdzbmG/YhlRnCWPnb8C898bRJGtQvEOiVxjYhtLOxs8AySiT4JuDystlVV4WPeM6tK3VaILeDZxIOSsuti/jidNGNZ3/J08yC1dNv9v8AAAA//8DAFBLAwQUAAYACAAAACEArTA/8cEAAAAyAQAACwAAAF9yZWxzLy5yZWxzhI/NCsIwEITvgu8Q9m7TehCRpr2I4FX0AdZk2wbbJGTj39ubi6AgeJtl2G9m6vYxjeJGka13CqqiBEFOe2Ndr+B03C3WIDihMzh6RwqexNA281l9oBF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UxLnhtbFBLAQItABQABgAIAAAAIQCcZkZBuwAAACQBAAAqAAAAAAAAAAAAAAAAAFwMAABjbGlwYm9hcmQvZHJhd2luZ3MvX3JlbHMvZHJhd2luZzEueG1sLnJlbHNQSwUGAAAAAAUABQBnAQAAXw0AAAAA"/><![endif]--><!--[if !vml]-->

After Logical OR<o
></o
>


</tbody>
</tbody>
<!--[endif]-->xxx<o
></o
>


[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] xx<o


[/TD]
[TD="width: 80, bgcolor: transparent"]
<o
></o
>


[TD="width: 80, bgcolor: transparent"]
<o
> </o
>


[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] x<o


[/TD]
[TD="width: 80, bgcolor: transparent"]
1<o
></o
>


[TD="width: 80, bgcolor: transparent"]
x<o
></o
>


[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] <o


[/TD]
[TD="width: 80, bgcolor: transparent"]
<o
></o
>


[TD="width: 80, bgcolor: transparent"]
<o
> </o
>


[/TR]
[TR]
[TD="width: 80, bgcolor: transparent"] xx<o


[/TD]
[TD="width: 80, bgcolor: transparent"]
1<o
></o
>


[TD="width: 80, bgcolor: transparent"]
xx<o
></o
>


[/TR]
</tbody>[/TABLE]
Col A col B colC<o


Col A and Col B can be variable length columns (but they arethe same size)<o


I need to perform a logical OR on col A & B (whichgenerates Col C). I want to take the output of the Logical OR (col C) andconcatenate all the non-blank cells separated by a delimiter (a space for thisexample). So the final result is a single cell with the contents “xxx x xx”which I’ll call the ANSWER<o


Since this is part of a user form I don’t want to generateCol C in the spreadsheet. I want it to be virtual with only a single cell result(hence it either needs to be a cell formula or a VBA function). I can do thiswith a cell formula using the concatenate function but for large columns, thecell formula won’t fit as it takes too many characters. I have a routine thatcan take a range of variable type data that will remove the blank cells andgenerate the ANSWER. Here it is: <o


<o


Function ConCat(Delimiter As Variant, ParamArrayCellRanges() As Variant) As String<o


Dim CellAs Range, Area As Variant<o


IfIsMissing(Delimiter) Then Delimiter = ""<o


<o


For EachArea In CellRanges<o


IfTypeName(Area) = "Range" Then<o


For Each Cell In Area<o


If Len(Cell.Value) Then ConCat = ConCat & Delimiter & Cell.Value<o


Next<o


Else<o


ConCat = ConCat & Delimiter& Area<o


EndIf<o


Next<o


ConCat =Mid(ConCat, Len(Delimiter) + 1)<o


End Function<o


<o


I can generate Col C with this formula {=IF((B1:B5=1),IF((A1:A5)="","",(A1:A5)),""))}<o


If I use the ConCat function on Col C, {=concat(“ “,C1:C5)}results in the ANSWER “xxx x xx”<o


If I type the values of ColC into the ConCat function{=concat(“ “,”xxx”,””,”x”,””,”xx”) I get the ANSWER<o


However if I combine the two to do this in 1-step:<o


{=concat(" ",IF((B1:B5=1),IF((A1:A5)="","",(A1:A5)),""))}I get #VALUE! Error<o


Looking at the debugger, the resultant of the above IF statementsthat passes the values to ConCat is exactly {=concat(“ “,”xxx”,””,”x”,””,”xx”)which then evaluates to the #VALUE! Error. What is happening? Why won’t itwork?<o


Some clues from spending a lot of debugging time. TheCaonCat function bombs at the step in yellow when it is trying to concatenate thevariant variable AREA (which TypeName (AREA) says is a string. Apparently theIF statements when parsed into the input to ConCat are placed into AREA as amulti-dimensional Array and it is not compatible with concatenate. The othercalls , {=concat(“ “,C1:C5)} and {=concat(“ “,”xxx”,””,”x”,””,”xx”) are parsedas individual cells and loop through one at a time. The combined function istrying to do it all in a single pass and not one cell at a time. <o


Anyone have any ideas on how to fix this?<o


Thanks<o


mark<o


<o

