我有类似的单元格
"Apple"
=+Organe +is +good
"Mango"
我想删除所有字符,即=
,"
和+
尝试过=SUBSTITUTE(C3,"+" ,"",1)
但没有成功
我正在使用Google表格,并且不能使用Excel(在MAC中)
如果您知道应删除哪些字符,应删除多少个字符 N个嵌套的替换项将起作用。只要确保输入单元格没有错误即可:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"="," "),"+"," "),"""","")
[如果需要排除字母A到Z和0到9之间的数字,VBA + RegEx生效:
Public Function RemoveNonAlphabetChars(inputString As String) As String
Dim regEx As Object
Dim inputMatches As Object
Dim regExString As String
Set regEx = CreateObject("VBScript.RegExp")
With regEx
.Global = True
.Pattern = "[^a-zA-Z0-9]"
.ignoreCase = True
Set inputMatches = .Execute(inputString)
If regEx.test(inputString) Then
RemoveNonAlphabetChars = .Replace(inputString, vbNullString)
Else
RemoveNonAlphabetChars = inputString
End If
End With
End Function