+ Reply to Thread
Results 1 to 7 of 7

COUNTIF with multiple text criteria

  1. #1
    Registered User
    Join Date
    03-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    COUNTIF with multiple text criteria

    Hi..... hope someone can help!


    I have now tried a few things for counting entries with different text criteria, unfortunately none do far worked.

    It normally works that when I use Countif to count all the cells in a certain range that with the word e.g. apple, that I know how many cells have apples.

    Now I would like to add that it should only count the word apple in a cell if in a different column the date is Dec 1st.

    So.....

    01/12/2012 pear
    02/12/2012 apple
    01/12/2012 apple
    03/12/2012 banana
    01/12/2012 apple
    05/12/2012 apple

    for all apples on Dec 1st the result should be 2.


    As I already read that Countif doesnt work for multiple criteria, I tried

    =SUMPRODUCT((A1:A6="01/12/2012")*(B1:B6="apple"))

    I also tried adding the criteria and therefore saying that it should count that what is in a specific cell

    =SUMPRODUCT((A1:A6=C1)*(B1:B6=D1))


    All result in Error or #N/A


    Can someone perhaps help?


    Thanks a lot!!

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

    Re: COUNTIF with multiple text criteria

    I also tried adding the criteria and therefore saying that it should count that what is in a specific cell

    =SUMPRODUCT((A1:A6=C1)*(B1:B6=D1))
    That should work.

    Can you post a SMALL sample file that shows the error when using that formula?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: COUNTIF with multiple text criteria

    hi Ted210, welcome to the forum. could you select the range & press CTRL + SHIFT + ~
    you should see all of them become numbers if they are real dates. then undo it. if they are all numbers, try:
    =SUMPRODUCT((A1:A6=--("1dec2012"))*(B1:B6="apple"))

    otherwise, attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Registered User
    Join Date
    03-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: COUNTIF with multiple text criteria

    Thank you for your help.

    They are numbers, unfortuntely still doesnt work, so I am attaching the file.
    Attached Files Attached Files

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

    Re: COUNTIF with multiple text criteria

    Ok, there are several problems with this.

    The dates in column C also contain the time so when you do a test for the date you have to take the time value into account.

    Also in column C, there is a single TEXT entry in cell C99. Is that really supposed to be there?

    The size of the ranges in the formula are different. All ranges must be the exact same size.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: COUNTIF with multiple text criteria

    Try this in J2:

    =SUMPRODUCT((TEXT($C$16:$C$210,"dd/mm/yyyy")="21/02/2013")*($N$16:$N$210=J1))

    Note that the ranges have to be the same size. Also, your "dates" contain times, hence the need to use the TEXT function to get them into the same format.

    Hope this helps.

    Pete

  7. #7
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: COUNTIF with multiple text criteria

    HI Ted,

    Use below formula:-
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    see attached:-
    Survey_2.xls

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

+ 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