+ Reply to Thread
Results 1 to 8 of 8

countif for text "*A"

  1. #1
    Registered User
    Join Date
    08-05-2009
    Location
    Wales UK
    MS-Off Ver
    Excel 2003
    Posts
    26

    Smile countif for text "*A"

    Hi,

    Can anyone help with this one please
    =countif(C3:C41,"*A") searching for number of *A but it returns all "A" as well.

    Cheers
    Diddy
    Last edited by Diddy; 09-08-2010 at 03:45 PM.

  2. #2
    Forum Contributor
    Join Date
    05-27-2008
    Location
    Newcastle Upon Tyne UK
    MS-Off Ver
    XP Excel 2003
    Posts
    105

    Re: countif for text "*A"

    Try this

    =SUMPRODUCT(--(C3:C41="*A"))

    edvwvw

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,308

    Re: countif for text "*A"

    Try:

    =COUNTIF(C3:C41,"~*A")

    Regards

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: countif for text "*A"

    the asterisk * is a wildcard. To search for the text string that contains an asterisk, you have to precede it with a tilde ~ like this

    =countif(C3:C41,"~*A")

    Edit: The asterisk is a wildcard for any number of characters. The ? sign is a wildcard for a single character. If you want to use any of these in a countif value, you need to escape them with the tilde sign ~. If your search string contains an actual tilde sign, you will need to double it

    =countif(C3:C41,"~?A") will count ?A
    =countif(C3:C41,"~~A") will count ~A

    cheers
    Last edited by teylyn; 09-07-2010 at 06:26 AM.

  5. #5
    Forum Contributor
    Join Date
    05-27-2008
    Location
    Newcastle Upon Tyne UK
    MS-Off Ver
    XP Excel 2003
    Posts
    105

    Re: countif for text "*A"

    Thanks Tetlyn - wasn't aware that you could use a tilde to search for *

    edvwvw

  6. #6
    Registered User
    Join Date
    08-05-2009
    Location
    Wales UK
    MS-Off Ver
    Excel 2003
    Posts
    26

    Smile Re: countif for text "*A"

    Quote Originally Posted by edvwvw View Post
    Try this

    =SUMPRODUCT(--(C3:C41="*A"))

    edvwvw
    Hi,

    Works a treat but how?

    after reading the other posts just wondered why sumproduct does not recognise * as wildcard?

    Cheers
    Diddy

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: countif for text "*A"

    Diddy, as far as I know, Sumproduct does not support wildcards in its comparison strings. It's verbatim as it is.

    Countif(), Sumif() or the newer versions Countifs() and Sumifs() in Excel 2007 and later are preferrable over Sumproduct, though, because they calculate a lot faster.

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

    Re: countif for text "*A"

    Following on from Teylyn's post ...

    Functions supporting Wildcards include (in addition to those listed already)

    MATCH & VLOOKUP (if using FALSE/0 return_type)
    SEARCH

    Others like FIND, SUBSTITUTE, EXACT etc do not support wildcards.

    Reiterating Teylyn's point regards SUMPRODUCT - wildcard support only viable if you were using one of the aforementioned functions in embedded form, eg:

    =SUMPRODUCT(--ISNUMBER(SEARCH("~*",C3:C41)))

    not that you would use it...

+ 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