IFs in Expression not working correctly

I have a column at the end of 22 enum columns that is an IF and if it doesnโ€™t equal one of the values then set the column to false. My problem is that when I have one of the correct ones selected, it will say True. Except when I have another column and select one that should set it to False, it will stay as True.

Expression:
IF(
IFS([1. The operator of the loader/backhoe is to inspect the machine] = at the beginning of each shift,True,
[2. All warning decals on the machine must be legible.] = True,True,
[3. Hydraulic fluid leaks are not a big concern on loader/backhoes.] = False,True,
[4. The operatorโ€™s manual needs to be located] = on the machine at all times.,True,
[5. The operator of the loader/backhoe is responsible for having read the operatorโ€™s manual.] = True,True,
[6. When the backhoe of the loader/backhoe is raised and extended, the machineโ€™s stability] = Decreases,True,
[7. When the loader/backhoe is crossing a slope, the machine is more susceptible to a rollover] = True,True,
[8. The machine can be operated with some of the safety guards missing.] = True,True,
[9. The operator should check the work area for hazards prior to beginning operations.] = True,True,
[10. Seat belts must be worn] = At all times.,True,
[11. When climbing off of the loader/backhoe, the operator should:] = Face the machine and use 3 pt contact,True,
[12. Who is responsible for job site safety?] = Everyone,True,
[13. The danger area when the backhoe is in operation is considered everywhere the backhoe can reach.] = True,True,
[14. Before a worker enters the danger area of a backhoe, the worker should] = Establish eye contact with the operator.,True,
[15. When the loader/backhoe is working, workers should not stand by the bucket or stabilizer pads.] = True,True,
[16. Before excavating with a loader/backhoe, all underground hazards should be Located and a Trenching Permit should be filled out.] = True,True,
[17. When trenching in previously filled areas, cave-ins are] = More likely to occur.,True,
[18. Material from an excavation should be stored] = At least two feet from the edge of the excavation.,True,
[19. Where can the lifting capacity of the loader/backhoe be found:] = All the above.,True,
[20. When attaching a sling to the attachment points on the backhoe, a shackle should be used] = True,True,
[21. Slings and all lifting hardware needs to be inspected] = Prior to each use.,True,
[22. Proper barricades are required at all job sites involving excavations.] = True,True,),True,False)

I basically just want it to say True if all of those are selected and if one isnโ€™t the right selection then be set as false. Or, since it is like a quiz, would there be a way to do a percentage of how many were right?

Solved Solved
0 2 479
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

IFS() evaluates the conditions and finds the first one that matches. Once it finds a match, it stops looking.

IFS() is probably not the right expression. Instead, as it sounds like you want the entire result to be TRUE only if all of the conditions are TRUE. I would suggest AND():

AND(
  [1. The operator of the loader/backhoe is to inspect the machine] = at the beginning of each shift,
  [2. All warning decals on the machine must be legible.] = True,
  [3. Hydraulic fluid leaks are not a big concern on loader/backhoes.] = False,
  [4. The operatorโ€™s manual needs to be located] = on the machine at all times.,
  [5. The operator of the loader/backhoe is responsible for having read the operatorโ€™s manual.] = True,
  [6. When the backhoe of the loader/backhoe is raised and extended, the machineโ€™s stability] = Decreases,
  [7. When the loader/backhoe is crossing a slope, the machine is more susceptible to a rollover] = True,
  [8. The machine can be operated with some of the safety guards missing.] = True,
  [9. The operator should check the work area for hazards prior to beginning operations.] = True,
  [10. Seat belts must be worn] = At all times.,
  [11. When climbing off of the loader/backhoe, the operator should:] = Face the machine and use 3 pt contact,
  [12. Who is responsible for job site safety?] = Everyone,
  [13. The danger area when the backhoe is in operation is considered everywhere the backhoe can reach.] = True,
  [14. Before a worker enters the danger area of a backhoe, the worker should] = Establish eye contact with the operator.,
  [15. When the loader/backhoe is working, workers should not stand by the bucket or stabilizer pads.] = True,
  [16. Before excavating with a loader/backhoe, all underground hazards should be Located and a Trenching Permit should be filled out.] = True,
  [17. When trenching in previously filled areas, cave-ins are] = More likely to occur.,
  [18. Material from an excavation should be stored] = At least two feet from the edge of the excavation.,
  [19. Where can the lifting capacity of the loader/backhoe be found:] = All the above.,
  [20. When attaching a sling to the attachment points on the backhoe, a shackle should be used] = True,
  [21. Slings and all lifting hardware needs to be inspected] = Prior to each use.,
  [22. Proper barricades are required at all job sites involving excavations.] = True,
)

Or, to get a count of correct answers:

SUM(
  LIST(
    IFS([1. The operator of the loader/backhoe is to inspect the machine] = at the beginning of each shift, 1),
    IFS([2. All warning decals on the machine must be legible.] = True, 1),
    IFS([3. Hydraulic fluid leaks are not a big concern on loader/backhoes.] = False, 1),
    IFS([4. The operatorโ€™s manual needs to be located] = on the machine at all times., 1),
    IFS([5. The operator of the loader/backhoe is responsible for having read the operatorโ€™s manual.] = True, 1),
    IFS([6. When the backhoe of the loader/backhoe is raised and extended, the machineโ€™s stability] = Decreases, 1),
    IFS([7. When the loader/backhoe is crossing a slope, the machine is more susceptible to a rollover] = True, 1),
    IFS([8. The machine can be operated with some of the safety guards missing.] = True, 1),
    IFS([9. The operator should check the work area for hazards prior to beginning operations.] = True, 1),
    IFS([10. Seat belts must be worn] = At all times., 1),
    IFS([11. When climbing off of the loader/backhoe, the operator should:] = Face the machine and use 3 pt contact, 1),
    IFS([12. Who is responsible for job site safety?] = Everyone, 1),
    IFS([13. The danger area when the backhoe is in operation is considered everywhere the backhoe can reach.] = True, 1),
    IFS([14. Before a worker enters the danger area of a backhoe, the worker should] = Establish eye contact with the operator., 1),
    IFS([15. When the loader/backhoe is working, workers should not stand by the bucket or stabilizer pads.] = True, 1),
    IFS([16. Before excavating with a loader/backhoe, all underground hazards should be Located and a Trenching Permit should be filled out.] = True, 1),
    IFS([17. When trenching in previously filled areas, cave-ins are] = More likely to occur., 1),
    IFS([18. Material from an excavation should be stored] = At least two feet from the edge of the excavation., 1),
    IFS([19. Where can the lifting capacity of the loader/backhoe be found:] = All the above., 1),
    IFS([20. When attaching a sling to the attachment points on the backhoe, a shackle should be used] = True, 1),
    IFS([21. Slings and all lifting hardware needs to be inspected] = Prior to each use., 1),
    IFS([22. Proper barricades are required at all job sites involving excavations.] = True, 1)
  )
)

View solution in original post

2 REPLIES 2

Steve
Platinum 4
Platinum 4

IFS() evaluates the conditions and finds the first one that matches. Once it finds a match, it stops looking.

IFS() is probably not the right expression. Instead, as it sounds like you want the entire result to be TRUE only if all of the conditions are TRUE. I would suggest AND():

AND(
  [1. The operator of the loader/backhoe is to inspect the machine] = at the beginning of each shift,
  [2. All warning decals on the machine must be legible.] = True,
  [3. Hydraulic fluid leaks are not a big concern on loader/backhoes.] = False,
  [4. The operatorโ€™s manual needs to be located] = on the machine at all times.,
  [5. The operator of the loader/backhoe is responsible for having read the operatorโ€™s manual.] = True,
  [6. When the backhoe of the loader/backhoe is raised and extended, the machineโ€™s stability] = Decreases,
  [7. When the loader/backhoe is crossing a slope, the machine is more susceptible to a rollover] = True,
  [8. The machine can be operated with some of the safety guards missing.] = True,
  [9. The operator should check the work area for hazards prior to beginning operations.] = True,
  [10. Seat belts must be worn] = At all times.,
  [11. When climbing off of the loader/backhoe, the operator should:] = Face the machine and use 3 pt contact,
  [12. Who is responsible for job site safety?] = Everyone,
  [13. The danger area when the backhoe is in operation is considered everywhere the backhoe can reach.] = True,
  [14. Before a worker enters the danger area of a backhoe, the worker should] = Establish eye contact with the operator.,
  [15. When the loader/backhoe is working, workers should not stand by the bucket or stabilizer pads.] = True,
  [16. Before excavating with a loader/backhoe, all underground hazards should be Located and a Trenching Permit should be filled out.] = True,
  [17. When trenching in previously filled areas, cave-ins are] = More likely to occur.,
  [18. Material from an excavation should be stored] = At least two feet from the edge of the excavation.,
  [19. Where can the lifting capacity of the loader/backhoe be found:] = All the above.,
  [20. When attaching a sling to the attachment points on the backhoe, a shackle should be used] = True,
  [21. Slings and all lifting hardware needs to be inspected] = Prior to each use.,
  [22. Proper barricades are required at all job sites involving excavations.] = True,
)

Or, to get a count of correct answers:

SUM(
  LIST(
    IFS([1. The operator of the loader/backhoe is to inspect the machine] = at the beginning of each shift, 1),
    IFS([2. All warning decals on the machine must be legible.] = True, 1),
    IFS([3. Hydraulic fluid leaks are not a big concern on loader/backhoes.] = False, 1),
    IFS([4. The operatorโ€™s manual needs to be located] = on the machine at all times., 1),
    IFS([5. The operator of the loader/backhoe is responsible for having read the operatorโ€™s manual.] = True, 1),
    IFS([6. When the backhoe of the loader/backhoe is raised and extended, the machineโ€™s stability] = Decreases, 1),
    IFS([7. When the loader/backhoe is crossing a slope, the machine is more susceptible to a rollover] = True, 1),
    IFS([8. The machine can be operated with some of the safety guards missing.] = True, 1),
    IFS([9. The operator should check the work area for hazards prior to beginning operations.] = True, 1),
    IFS([10. Seat belts must be worn] = At all times., 1),
    IFS([11. When climbing off of the loader/backhoe, the operator should:] = Face the machine and use 3 pt contact, 1),
    IFS([12. Who is responsible for job site safety?] = Everyone, 1),
    IFS([13. The danger area when the backhoe is in operation is considered everywhere the backhoe can reach.] = True, 1),
    IFS([14. Before a worker enters the danger area of a backhoe, the worker should] = Establish eye contact with the operator., 1),
    IFS([15. When the loader/backhoe is working, workers should not stand by the bucket or stabilizer pads.] = True, 1),
    IFS([16. Before excavating with a loader/backhoe, all underground hazards should be Located and a Trenching Permit should be filled out.] = True, 1),
    IFS([17. When trenching in previously filled areas, cave-ins are] = More likely to occur., 1),
    IFS([18. Material from an excavation should be stored] = At least two feet from the edge of the excavation., 1),
    IFS([19. Where can the lifting capacity of the loader/backhoe be found:] = All the above., 1),
    IFS([20. When attaching a sling to the attachment points on the backhoe, a shackle should be used] = True, 1),
    IFS([21. Slings and all lifting hardware needs to be inspected] = Prior to each use., 1),
    IFS([22. Proper barricades are required at all job sites involving excavations.] = True, 1)
  )
)

Thank you

Top Labels in this Space