如何使用Excel公式从格式化文本中的Excel单元格中提取大文本?

我在Excel单元格中有以下文本:

$abcd.$efghijk.$lmn.$op.$qrst. 

我只想在Excel单元格中使用Excel公式的以下格式的以上文本:

 abcd$abcd.efghijk$efghijk.lmn$lmn.op$op.qrst$qrst. 

以下是我将根据讨论提出的build议。

在通用模块中,插入以下代码。

 Public Function RepeatCustom(strInput As String) As String Dim varInput As Variant Dim i As Long If Len(strInput) = 0 Then RepeatCustom = "" Else varInput = Split(strInput, ".") For i = LBound(varInput) To UBound(varInput) RepeatCustom = RepeatCustom & " " & Mid(varInput(i), 2, Len(varInput(i))) & varInput(i) Next RepeatCustom = Replace(Trim(RepeatCustom), " ", ".") & "." End If End Function 

然后假设包含原始数据的单元格为A2,则可以使用上面的UDF:

= RepeatCustom(A2)

请注意,代码是最小的,并基于发布的样本。