+ Reply to Thread
Results 1 to 8 of 8

If Statement to return Fail Pass Merit or Distinction.

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    If Statement to return Fail Pass Merit or Distinction.

    Hi,

    I have attached an image to help explain.
    What I want is if all "Pass" cells have a Y or Y* in then the grade displays "Pass" if not to display "Fail". If the Merit cells contain Y or Y* the grade needs to display "Merit" and the same for Distinction.

    However if all merit and distinction are Y or Y* but there is one missing from the Pass the grade needs to say "Fail".

    I hope I have explained it well enough to understand and would appreciate any help.

    Formula i have at the moment to just display pass:
    =IF((AND(OR(C10="Y*",C10="Y"),OR(D10="Y*",D10="Y"),OR(E10="Y*",E10="Y"),OR(F10="Y*",F10="Y"),OR(G10="Y*",G10="Y"),OR(H10="Y*",H10="Y"),OR(I10="Y*",I10="Y"),OR(J10="Y*",J10="Y"))),"PASS","FAIL")
    Attached Images Attached Images

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: If Statement to return Fail Pass Merit or Distinction.

    Hi,

    Try this:

    =IF(COUNTIF(C2:J2,"*Y*")<8,"Fail",IF(COUNTIF(Q2:T2,"*Y*")>0,"Distinction",IF(COUNTIF(K2:P2,"*Y*")>0,"Merit","Pass")))

    It's not clear from your description if all the merit/distinction cells need to be occupied with Y or Y* , or just one . I have assumed just one is required.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    06-03-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: If Statement to return Fail Pass Merit or Distinction.

    Thank you for your quick reply.

    Sorry i forgot to mention, all the merits need to be Y or Y* to be return a merit and the same with distinctions. i presume i just have to change the >0 to 6 and 4 respectively.

    I have just tried the forumla with the pass criteria and its just returning TRUE whether there are 7 Ys or 8.

    also can you explain how "*Y*" means Y or Y*.

    Thanks

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: If Statement to return Fail Pass Merit or Distinction.

    TO modify try this:

    =IF(COUNTIF(C2:J2,"*Y*")<8,"Fail",IF(COUNTIF(Q2:T2,"*Y*")=4,"Distinction",IF(COUNTIF(K2:P2,"*Y*")=6,"Merit","Pass")))

    the asterisk in the countif criteria is a wildcard of indeterminate length, so ="*Y*" is true for any cell that contains the letter y

  5. #5
    Registered User
    Join Date
    06-03-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: If Statement to return Fail Pass Merit or Distinction.

    Thanks for that, it works quite well but not 100% correct. Is there a way to make it so if there is 1 merit missing the grade will be a pass. Even if all the distinctions have been met and 1 merit is missing the overall grade will still be a pass.

    sorry to be a pain.

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: If Statement to return Fail Pass Merit or Distinction.

    No Pain!!!

    =IF(COUNTIF(C2:J2,"*Y*")<8,"Fail",IF(AND(COUNTIF(Q2:T2,"*Y*")=4,COUNTIF(K2:P2,"*Y*")=6),"Distinction",IF(COUNTIF(K2:P2,"*Y*")=6, "Merit","Pass")))

  7. #7
    Registered User
    Join Date
    06-03-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: If Statement to return Fail Pass Merit or Distinction.

    SUPER!! thats perfect, Thank you for you help.

  8. #8
    Registered User
    Join Date
    09-13-2010
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: If Statement to return Fail, Pass, Merit or Distinction

    This has help me a lot too. Thanks guys.
    Last edited by CapeDutch; 09-13-2010 at 12:15 PM.

+ 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