从 Google 表格中的单元格中删除 " 和 =+
Remove " and =+ from cells in Google Sheets
我有像
这样的细胞
"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
尝试:
=ARRAYFORMULA(REGEXREPLACE(A1:A, "[=\+""]", ))
或者如果您想使用 SUBSTITUTE
那么:
=ARRAYFORMULA(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1:A, "=", ), "+", ), """", ))
我有像
这样的细胞"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
尝试:
=ARRAYFORMULA(REGEXREPLACE(A1:A, "[=\+""]", ))
或者如果您想使用 SUBSTITUTE
那么:
=ARRAYFORMULA(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1:A, "=", ), "+", ), """", ))