我在表中有这个公式,它基本上从两列收集数据并将它们组合起来。现在,我希望将此公式与REPLACE
公式结合起来,该公式基本上采用这些字符æ,ø,å
并将其替换为a,o,a
。
这是公式:
=LOWER(LEFT(tableFaste[[#This Row];[Fornavn:]])&tableFaste[[#This Row];[Etternavn:]])
答案 0 :(得分:2)
抱歉,不知道从字符串中删除任何字符列表的公式方法。您可能必须为此恢复为vba。这是用户定义的功能。你的公式将成为
=DeleteChars([@UserName],{"æ","ø","å";"a","o","a"})
要替换字符,请使用{“æ”,“ø”,“å”;“a”,“o”,“a”}列表中的列表;是旧的人物,后;新的。您可以根据需要制作列表,只需确保列表长度相同即可 要删除字符,请使用{“æ”,“ø”,“å”}要删除的字符数组列表
UDF代码:
Function DeleteChars(r1 As Range, ParamArray c() As Variant) As Variant
Dim i As Long
Dim s As String
s = r1
If UBound(c(0), 1) = 1 Then
For i = LBound(c(0), 2) To UBound(c(0), 2)
s = Replace(s, c(0)(1, i), "")
Next
Else
For i = LBound(c(0), 2) To UBound(c(0), 2)
s = Replace(s, c(0)(1, i), c(0)(2, i))
Next
End If
DeleteChars = s
End Function
答案 1 :(得分:1)
您可以使用SUBSTITUTE
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(LOWER(LEFT(tableFaste[[#This Row];[Fornavn:]])&tableFaste[[#This Row];[Etternavn:]]),"æ","a"),"ø","o"),"å","a")