11 Replies Latest reply on Oct 16, 2018 5:02 AM by ShivaRam Chennapragada

    IF statement with multiple conditions

    Jillian Milne

      Hi

       

      I am trying to create a calculated field that evaluates the text in 4 dimensions (columns titles are heart vessel names).  The calculation I have written is valid but it is not returning the expected results.  It only returns the result for the last line of code and all other cases fall in the 'STILL TO CODE' section.

       

      The text content in each of the columns is a description of a stent put into a heart vessel  so the text is extremely heterogeneous (as there are many different stents - manufacturer, size etc)  so it would take too long to set up a search on the text.   So I wrote an IF statement that uses = and <> using multiple lines with each line using a combination of = and<> to return the combination of vessels treated.  When the column has no text, the result comes back 'Null' in text.

       

      If someone could help, it would be greatly appreciated.  I tried searching but couldn't find an example that fitted my situation.

       

      Thanks

       

      Jillian

       

      IF [Stent(s) LAD] = 'Null' and [Stent(s) LCX] = 'Null' and [Stent(s) RCA] = 'Null' and [Stent(s) Other] = 'Null' THEN 'No locations recorded'

       

      ELSEIF  ([Stent(s) LAD] <> 'Null' and [Stent(s) LCX] = 'Null' and [Stent(s) RCA] = 'Null' and [Stent(s) Other] = 'Null') THEN 'LAD'

       

      ELSEIF   ([Stent(s) LAD] = 'Null' and [Stent(s) LCX] <> 'Null' and [Stent(s) RCA] = 'Null' and [Stent(s) Other] = 'Null') THEN 'LCX'

       

      ELSEIF   ([Stent(s) LAD] = 'Null' and [Stent(s) LCX] = 'Null' and [Stent(s) RCA] <> 'Null' and [Stent(s) Other] = 'Null') THEN 'RCA'

       

      ELSEIF  ([Stent(s) LAD] = 'Null' and [Stent(s) LCX] = 'Null' and [Stent(s) RCA] = 'Null' and [Stent(s) Other] <> 'Null') THEN 'OTHER'

       

      ELSEIF   ([Stent(s) LAD] <> 'Null' and [Stent(s) LCX] <> 'Null' and [Stent(s) RCA] = 'Null' and [Stent(s) Other] = 'Null') THEN 'LAD;LCX'

       

      ELSEIF  ([Stent(s) LAD] = 'Null' and [Stent(s) LCX] <> 'Null' and [Stent(s) RCA] <> 'Null' and [Stent(s) Other] = 'Null') THEN 'LCX;RCA'

       

      ELSEIF ([Stent(s) LAD] <> 'Null' and [Stent(s) LCX] = 'Null' and [Stent(s) RCA] = 'Null' and [Stent(s) Other] <> 'Null') THEN 'LAD;OTHER'

       

      ELSEIF   ([Stent(s) LAD] <> 'Null' and [Stent(s) LCX] <> 'Null' and [Stent(s) RCA] = 'Null' and [Stent(s) Other] <> 'Null') THEN 'LAD;LCX;OTHER'

       

      ELSEIF   ([Stent(s) LAD] <> 'Null' and [Stent(s) LCX] <> 'Null' and [Stent(s) RCA] <> 'Null' and [Stent(s) Other] = 'Null') THEN 'LAD;LCX;RCA'

       

      ELSEIF   ([Stent(s) LAD] = 'Null' and [Stent(s) LCX] <> 'Null' and [Stent(s) RCA] <> 'Null' and [Stent(s) Other] <> 'Null') THEN 'LCX;RCA;OTHER'

       

      ELSEIF   ([Stent(s) LAD] <> 'Null' and [Stent(s) LCX] <> 'Null' and [Stent(s) RCA] <> 'Null' and [Stent(s) Other] <> 'Null') THEN 'LAD;LCX;RCA;OTHER'

       

      ELSE 'STILL TO CODE'

       

      END