Forum Discussion

matt2911's avatar
matt2911
Copper Contributor
Apr 11, 2024
Solved

If statement explanation please

Hello, 

 

please can somebody explain this if statement in plain english or bullet pointed please? also please let me know what order of each 'if' is executed first 🙂  Thank you!!

 

=IF($H6="","",IF($H6>$U$3,"",IF(OR($K6="",$K6>$U$3,$P6="DNA",$P6="Error"),$U$3-$H6,$K6-$H6)))

  • matt2911 The formula is evaluated from left to right.

    • It first checks whether H6 is blank. If so, it returns a blank, and stops evaluating the formula further.
    • Otherwise, i.e. if H6 is not blank, it checks whether the value of H6 is greater than that of U3. If so, it also returns a blank and stops evaluating.
    • Otherwise, i.e. if H6 is neither blank nor greater than U3, it checks whether at least one of the following conditions is met:
      1. K6 is blank
      2. The value of K6 is greater than that of U3.
      3. P6 equals DNA
      4. P6 equals Error.
    • If at least one of those conditions is met, the formula returns the value of U3-H6 and stops evaluating.
    • Otherwise, i.e. if none of the previous conditions is met, the formula returns the value of K6-H6.

2 Replies

  • matt2911 The formula is evaluated from left to right.

    • It first checks whether H6 is blank. If so, it returns a blank, and stops evaluating the formula further.
    • Otherwise, i.e. if H6 is not blank, it checks whether the value of H6 is greater than that of U3. If so, it also returns a blank and stops evaluating.
    • Otherwise, i.e. if H6 is neither blank nor greater than U3, it checks whether at least one of the following conditions is met:
      1. K6 is blank
      2. The value of K6 is greater than that of U3.
      3. P6 equals DNA
      4. P6 equals Error.
    • If at least one of those conditions is met, the formula returns the value of U3-H6 and stops evaluating.
    • Otherwise, i.e. if none of the previous conditions is met, the formula returns the value of K6-H6.
    • matt2911's avatar
      matt2911
      Copper Contributor
      Thats amazing thank you for your time 🙂

Resources