You can do it with a formula:
=LEN(A1)-LEN(SUBSTITUTE(A1,"e",""))
This is case sensitive. For case insensitive, use
=LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),"E",""))
In code, use
Dim S As String
Dim N As Long
S = Range("A1").Text
N = Len(S) - Len(Replace(S, "e", vbNullString))
Debug.Print N
This is case sensitive. For case insensitive, use
Dim S As String
Dim N As Long
S = Range("A1").Text
N = Len(S) - Len(Replace(UCase(S), "E", vbNullString))
Debug.Print N
Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Mon, 24 Nov 2008 10:51:43 -0800 (PST), fallowfz
<(E-Mail Removed)> wrote:
>Is there a function which will return the number of times, for
>example, the letter "E" appears in a cell containing a mix of text,
>numbers, and other characters, e.g. (), :, etc?
>
>
>Thanks!