+ Reply to Thread
Results 1 to 2 of 2

Counting the Occurence of Special characters in Single/Multiple cells?

  1. #1
    all4excel
    Guest

    Counting the Occurence of Special characters in Single/Multiple cells?

    Counting the Occurence of Special characters in Single/Multiple cells?

    Lets say i have a cell containing special characters like "-"'s dashes or "*" asteriks in a single cell..

    How do I count the occurence in a single cell..

    EX1- B2 contains the text A*12*34*56*78*910..

    Now what formula would give me an answer , that there are 5 asteriks,,

    Countif(Range,"*")?
    Last edited by VBA Noob; 05-23-2008 at 02:41 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Try this
    =SUM(LEN(A1)-LEN(SUBSTITUTE(A1,"*","")))

  3. #3
    all4excel
    Guest

    Smile Thanks that was excellent-Short and Compact...

    Quote Originally Posted by davesexcel
    Try this
    =SUM(LEN(A1)-LEN(SUBSTITUTE(A1,"*","")))

    Thanks that was excellent-Short and Compact...

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You don't actually need the Sum() part...

    e.g... =LEN(A2)-LEN(SUBSTITUTE(A2,"*","")) will give you 5
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    all4excel
    Guest

    Smile Yes you are right NBVC...!

    Quote Originally Posted by NBVC
    You don't actually need the Sum() part...

    e.g... =LEN(A2)-LEN(SUBSTITUTE(A2,"*","")) will give you 5
    Yes you are right NBVC, I should have figured it out myself....
    Need to go a long way...!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1