+ Reply to Thread
Results 1 to 6 of 6

COUNTIF not counting correctly

  1. #1
    Registered User
    Join Date
    10-23-2015
    Location
    South West, England
    MS-Off Ver
    2010
    Posts
    4

    COUNTIF not counting correctly

    I have this line

    =COUNTIF((AP3:AP43),"A*")+COUNTIF((AP3:AP43),"A")+COUNTIF((AP3:AP43),"B")+COUNTIF((AP3:AP43),"C")

    designed to count up all the students in a column achieving A* to C, however in every case it is counting higher than the actual number. Through trial and error, I realised it is the A* part that is throwing it out but I don't know why. How do I get it to include a proper count with an A* entry?

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: COUNTIF not counting correctly

    "A*" it will count A and A*
    or
    "A~*" it will count only A*

  3. #3
    Registered User
    Join Date
    10-23-2015
    Location
    South West, England
    MS-Off Ver
    2010
    Posts
    4

    Re: COUNTIF not counting correctly

    Aha! Thank you again

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: COUNTIF not counting correctly

    You are welcome again

    Got help? As thanks give a star* & mark thread SOLVED! (Thread Tools->Mark thread as Solved) Thank You

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: COUNTIF not counting correctly

    btw. you can use much shorter formula, like: =SUM(COUNTIF(AP3:AP43,{"A","A~*","B","C"}))

    regards

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: COUNTIF not counting correctly

    In the COUNTIF function the asterisk * is a wildcard character which means any character(s) or no characters(s).

    If this was your data:

    Apple
    Train
    Adam
    Sam
    A

    =COUNTIF(AP3:AP43,"A*")

    Returns 3, counting Apple, Adam and A.

    If you have data like this:

    A*
    B+
    C-
    A*
    F

    And you want to count entries that are A*...

    =COUNTIF(AP3:AP43,"A~*")

    The tilde character tells Excel to treat the asterisk * as the literal character and not a wildcard.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Countif not counting date correctly
    By ciresuark in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-03-2015, 07:27 PM
  2. [SOLVED] SUMPRODUCT, COUNTIF formulas not correctly counting based on two sets of criteria
    By justinbelkin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-11-2013, 10:12 AM
  3. Excel COUNTIFS not counting data correctly
    By Linda Borza in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 08-21-2013, 09:19 PM
  4. Replies: 7
    Last Post: 12-16-2012, 08:24 PM
  5. Excel 2007 : Countif function Not working correctly
    By carl.spackler in forum Excel General
    Replies: 12
    Last Post: 04-09-2012, 06:39 PM
  6. Countif not counting correctly...
    By AaronK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2012, 12:43 PM
  7. sumproduct not counting correctly
    By excellentexcel in forum Excel General
    Replies: 3
    Last Post: 03-08-2009, 03:55 PM

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