+ Reply to Thread
Results 1 to 3 of 3

Count function required

Hybrid View

  1. #1
    Registered User
    Join Date
    01-31-2006
    Location
    Sydney
    Posts
    19

    Count function required

    Hi all,
    Just wondering if there is a function which will count the number of occurences of a character within a cell.
    eg A1 contains "x-ab-c"
    I want to know the number of hyphens in that cell (answer 2)

    Has anyone come up against this one before?

    Regards Mick Barry
    Sydney
    You don't need a parachute to skydive,
    You only need a parachute to skydive twice...

  2. #2
    Chip Pearson
    Guest

    Re: Count function required

    Try a formula like the following

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


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "mickbarry"
    <[email protected]> wrote in
    message
    news:[email protected]...
    >
    > Hi all,
    > Just wondering if there is a function which will count the
    > number of
    > occurences of a character within a cell.
    > eg A1 contains "x-ab-c"
    > I want to know the number of hyphens in that cell (answer 2)
    >
    > Has anyone come up against this one before?
    >
    > Regards Mick Barry
    > Sydney
    > You don't need a parachute to skydive,
    > You only need a parachute to skydive twice...
    >
    >
    > --
    > mickbarry
    > ------------------------------------------------------------------------
    > mickbarry's Profile:
    > http://www.excelforum.com/member.php...o&userid=31028
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=510869
    >




  3. #3
    Registered User
    Join Date
    01-31-2006
    Location
    Sydney
    Posts
    19
    Chip,
    Very clever.
    I did think that the Substitute would go close due to its ability to look past the first occurrence.
    However I was just not smart enough to come up with the answer.
    Well done

    Regards Mick Barry
    If you give a man a match, he will be warm for a moment, but if you light a man on fire, he will be warm for the rest of his life!

+ 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