Nested IF statement returning false

12,279

The first and second IF's seem to be missing the else part. They should be added at the end between the ))) like ), else ), else ) Every IF statement consists of IF( condition, truepart, falsepart) if you have two nested ifs it will be something like IF( condition, IF( condition2, truepart2, falsepart2), falsepart) Hope that makes it a little clearer

Share:
12,279
Val VonDanikan
Author by

Val VonDanikan

Updated on June 04, 2022

Comments

  • Val VonDanikan
    Val VonDanikan almost 2 years

    I have a nested if statement is returning "False" rather than the expected outcome.

    Scenario

    Table "High VoltageCables" has data in it that default to numeric but may contain characters: kVa

    Table "Master" checks "High VoltageCables" data as blank or not blank, and returns "Failed Check 1","Passed Check 1". This works fine.

    Table "Meta" then checks the results of "Master" and then tests "High VoltageCables" data for length between 1 and 6, regardless of whether record is numeric or string.

    Formula

    =IF(MASTER!H2="Passed Check 1",IF(LEN('High VoltageCables'!O2)>=1,IF(LEN('High VoltageCables'!O2<6),"Passed Check 2","Failed Check 2")))
    

    This is partially succesful, as it returns "Passed Check 2" for the following sample data in the source table "High VoltageCables".

    1 numeric, or

    1kVa str, or

    50000 numeric

    However if a field in "High VoltageCables"is blank, the formula returns "FALSE" rather than "Failed Check 1"

    I inherited this task, (and would have preferred to do the whole thing in Access using relatively simple queries) - and unfortunately I am new to nested If statements, so I am probably missing something basic...

    NB the data in High VoltageCables must default to numeric for a further check to work.

  • Val VonDanikan
    Val VonDanikan over 8 years
    Thank you, but apologies - can you elucidate ?