如果特定字符为“A”,那么输入
=(LEN(A1)-LEN(SUBSTITUTE(A1,"A","")))/LEN("A")
详见附图示例
假设你要在单元格["A1:C3"]中找“A”
sub main
dim A的数量%
A的数量=strtotal(range(cells(1,1),cells(3,3)),“A”)
msgbox A的数量
end sub
function strtotal(rng as range,str$)
dim acell as range, astr$,strary() as string
for each acell in rng
astr=astr & cstr(acell.value)
next acell
strary=split(astr,str)
strtotal=ubound(strary())
end function