+ Reply to Thread
Results 1 to 5 of 5

If Statement with AND problem

  1. #1
    Registered User
    Join Date
    09-07-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    11

    If Statement with AND problem

    Hi,

    My problem here is that in my formula there is two different logical test that has the same condition.
    What my formula needs to do is to give the sanction depending on the number of instance per offense.

    Example:

    Tardy:
    1st Offense: Documented Coaching
    2nd offense: Documented Coaching
    3rd offense: First Written
    4th Offense: Final Written
    5th offense: 2 day Suspension
    6th offense:Termination

    Tardy:
    1st Offense: Documented Coaching
    2nd offense: Documented Coaching
    3rd offense: First Written
    4th Offense: Final Written
    5th offense: 2 day Suspension
    6th offense:Termination

    AWOL :
    1st Offense: Final Written
    2nd offense: 2 day Suspension
    3rd offense: Termination

    Undertime:
    1st Offense: 2 day Suspension
    2nd Offense: Termination

    here is the formula I am using right now: =IF(AND(K28="Tardy",L28<=2),"Documented Coaching",IF(AND(K28="Tardy",L28=3),"First Written",IF(AND(K28="Tardy",L28=4),"Final Written",IF(AND(K28="Tardy",L28=5),"2 day Suspension",IF(AND(K28="Tardy",L28>=6),"Termination",IF(AND(K28="Overbreak",L28<=2),"Documented Coaching",IF(AND(K28="Overbreak",L28=3),"First Written",IF(AND(K28="Overbreak",L28=4),"Final Written",IF(AND(K28="Overbreak",L28=5),"2 day Suspension",IF(AND(K28="Overbreak",L28>=6),"Termination",IF(AND(K28="Undertime",L28=1),"2 day Suspension",IF(AND(K28="Undertime",L28>=2),"Termination",IF(AND(K28="Absence Unplanned and Unapproved",L28=1),"First Written",IF(AND(K28="Absence Unplanned and Unapproved",L28=2),"Final Written",IF(AND(K28="Absence Unplanned and Unapproved",L28=3),"2 day Suspension",IF(AND(K28="Absence Unplanned and Unapproved",L28>=4),"Termination",IF(AND(K28="AWOL",L28=1),"Final Written",IF(AND(K28="AWOL",L28=2),"2 day Suspension",IF(AND(K28="Undertime",L28>=3),"Termination")))))))))))))))))))

    It works for all offenses except for overbreak since it has the same condition with tardy.
    Anyone who can help me sort this out?

    Thanks in advance.
    Last edited by bpiroma; 09-10-2012 at 09:27 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: If Statement with AND problem

    Stop set up a table

    Then use index and match, nested ifs like that can be delt with a lot better, if I wasn't in a iPad I'd mock you,up a sheet fast but I can't

    I think if you listed your offence along the top
    The number down the side then the punishment in the matrix and index / match it it will solve your problem a lot more effiecntly.
    The Importance of INDEX - A GUIDE TO INDEX'S OTHER USES
    <--- If a post helps hit the star

  3. #3
    Registered User
    Join Date
    09-07-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: If Statement with AND problem

    Thanks for the reply.
    I will try it then, hopefully I'd be able to make use of it since I am not familiar with it.

    Just in case, I am attaching the worksheet that I am using.
    The table on top is the tracker itself while the table below is the offense/instance matrix.
    Attached Files Attached Files
    Last edited by bpiroma; 09-07-2012 at 10:22 PM.

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: If Statement with AND problem

    in G4

    =INDEX($C$17:$H$21,MATCH(E4,$B$17:$B$21,0),F4) - fill down


    =iferror(INDEX($C$17:$H$21,MATCH(E4,$B$17:$B$21,0),F4),"No offense found")

    or

    INDEX($C$17:$H$21,MATCH(E4,$B$17:$B$21,0),F4)&""
    Last edited by vlady; 09-07-2012 at 10:40 PM.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Registered User
    Join Date
    09-07-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: If Statement with AND problem

    Coolness.. Super thanks vlady..

+ 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