View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Count occurences in string

The below formula will do.

=LEN(A1)-LEN(SUBSTITUTE(A1,"-",))

If this post helps click Yes
---------------
Jacob Skaria


"Ken" wrote:

This should be very simple, but I don't see how to do it without a macro:
How do you count the number of hyphens (for example) in a string?

abc-de-a32-ej2-wkjew-w should give 5
we2-232if should give 1
wekjf2 should give 0