+ Reply to Thread
Results 1 to 8 of 8

Multiple If countifs

  1. #1
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Multiple If countifs

    Hello,

    I'd like to use multiple if countifs, I tried a couple of formulas and even though the formulas work I keep getting the wrong results.

    I've tried the following:

    =IF(COUNTIFS(D4:E4,CHAR(251))+COUNTIFS(O4:P4,CHAR(252)),CHAR(251),CHAR(252))

    =IF(AND(COUNTIFS(D4:E4,CHAR(251),O4:P4,CHAR(252))),CHAR(251),CHAR(252))


    What's the problem with the above?

    Thank you,
    Sans
    Last edited by sans; 01-24-2012 at 10:50 AM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Multiple If countifs

    Hi Sans

    I use Excel 2003, so i can not tell you for countifs...

    I am quite sure that you can do this with SUPRODUCT, as well.

    So would you like to upload a sample workbook??
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Multiple If countifs

    From what I can see this doesn't need COUNTIFS(), COUNTIF() will do.
    What it does need is the IF() condition qualified.
    Please Login or Register  to view this content.
    What are you really trying to do? CHAR(251) & CHAR(252) are pretty unusual qualifiers.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Multiple If countifs

    Thank you both for your replies.

    Actually the ranges I'd like to check are three. D4:E4, O4:P4 and Q4:Z4. The cells have either checkmarks or Xs.

    I'd like to check, if in the first range all cells have Xs, the second range all checkmarks, and the third range all checkmarks, to get a checkmark otherwise get an X.

    I'd like to use countifs or countif,or any other function that allows me to change the ranges very fast, that's why I avoided using sumproduct.

    Thank you,

    Spy

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple If countifs

    Try:

    =IF(AND(COUNTIF(D4:E4,CHAR(251))=2,COUNTIF(O4:P4.CHAR(252))=2,COUNTIF(Q4:Z4,CHAR(252))=10),CHAR(252),CHAR(251))

    or

    =IF(OR(COUNTIF(D4:E4,CHAR(252)),COUNTIF(O4:P4.CHAR(251)),COUNTIF(Q4:Z4,CHAR(251))),CHAR(251),CHAR(252))

    which checks if either of the 3 ranges has at least one of the opposite symbol, then you get an X....otherwise a checkmark
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Multiple If countifs

    Thank you for the reply NBVC.

    I tried both formulas and the second one works great. I don't understand though why this one doesn't seem to be giving the correct results.

    =IF(AND(COUNTIF(D4:E4,CHAR(251)),COUNTIF(O4:P4,CHAR(252)),COUNTIF(Q4:Z4,CHAR(252))),CHAR(252),CHAR(251))

    Thank you for the reply

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple If countifs

    Your formula is checking that all 3 countifs return at least 1 match... so that means that only if there is at least one x in D4:E4, at least one check mark in O4:P4 and at least one check in Q4:Z4, then it will result in a checkmark... it does not check if all cells are marked with x's or check marks...

  8. #8
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Multiple If countifs

    Excellent, thank you for the explanation NBVC!

    Sans

+ 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