如何使用excel数组公式使用字符串数组?

时间:2016-07-01 20:06:26

标签: excel excel-formula

我有一个像这样的字符串数组:

{"value 1","","Value 2","","Value 3",...}

我希望它是这样的CONCATENATEd:

value 1, value 2, value 3, ...

有建议使用自己的UDF,但我不想使用任何vba或UDF。我需要使用原生的Excel功能

与使用号码=SUM({1,2,3,4})时相同会产生10

我需要像=CONCATENATE({"value 1","","Value 2","","Value 3",...})

这样的类似内容

enter image description here

2 个答案:

答案 0 :(得分:0)

您不能,至少在Office 2010上。您必须在VBA上创建自己的UDF。这样的事情可以帮到你:

Function JoinAll(ByVal BaseValue, ByRef rng As Range, ByVal delim As String)
'code by Jindon, MrExcel.com MVP
Dim a, i As Long
a = rng.Value
For i = 1 To UBound(a, 1)
    If a(i, 1) = BaseValue Then JoinAll = JoinAll & _
        IIf(JoinAll = "", "", delim) & a(i, 2)
Next
End Function

答案 1 :(得分:0)

我无法引用D4,但是我重新引用了数组本身,然后我可以执行以下操作:

=INDEX({"Value 1","","Value 2","","Value 3"},1)&", "&INDEX({"Value 1","","Value 2","","Value 3"},3)&", "&INDEX({"Value 1","","Value 2","","Value 3"},5)

以下不起作用:

=INDEX(D4,1)&", "&INDEX(D4,3)&", "&INDEX(D4,5)