+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : couting how many ? marks in one cell

  1. #1
    Registered User
    Join Date
    10-19-2008
    Location
    Tokyo
    MS-Off Ver
    MS Offuce 2019
    Posts
    45

    couting how many ? marks in one cell

    Hi,

    I would like to know if there is a way to count how many Question marks or specific word is in one cell.

    For example in one cell:
    A2:
    -----------------------------------------------------
    | Is Mark home yet?           |
    | No, Mark is not here.          |
    | Why Mark?                |
    -----------------------------------------------------

    What I am looking for would be something like this:

    =COUNTIF(A2:A2,"?")       ->2
    OR
    =COUNTIF(A2:A2,"MARK")   ->3

    COUNTIF was just an example I choose, but does anyone know how I can make this happen?

    Thank You

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: couting how many ? marks in one cell

    Hi,
    the following formula finds the number of ? in cell A1
    =(LEN(A1)-LEN(SUBSTITUTE(A1;"?";"")))/LEN("?")
    Replace ; with , if needed

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: couting how many ? marks in one cell

    You can in theory use LEN

    For specific chars

    B1: =LEN($A1)-LEN(SUBSTITUTE($A1,$C$1,""))
    where C1 holds ?

    For specific words & exact matches it's safer to use something like

    B1: =(LEN(" "&$A1)-LEN(SUBSTITUTE(" "&$A1," "&$C$1,"")))/LEN(" "&$C$1)
    where B1 holds Mark

    Even then however this is not watertight ... eg Marks would equal 1 for Mark... you can't use " Mark " as criteria given "Mark?" would be ignored in the count.

    Hope that helps some...

  4. #4
    Registered User
    Join Date
    10-19-2008
    Location
    Tokyo
    MS-Off Ver
    MS Offuce 2019
    Posts
    45

    Re: couting how many ? marks in one cell

    It works GREAT!!

    Thank you both for your quick responses.

+ 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