4 Replies Latest reply on Aug 1, 2013 9:58 AM by Matt Lutton

# Can you specify Null values in IF/THEN/ELSE/END?

Hi,

I'm creating a calculated field where I want to group all my program types into either Major or Minor.  Some program types are blank and should be considered a Major, but I'm getting a grouping of Major, Minor, and Null.  My syntax is below.

If ([Department1] = [Select Department] and [primprg1] <> "MIN")

or ([Department2] = [Select Department] and [primprg2] <> "MIN")

or ([Department3] = [Select Department] and [secnprg1] <> "MIN")

or ([Department4] = [Select Department] and [secnprg2] <> "MIN")

THEN "Major"

ELSEIF ([Department1] = [Select Department] and [primprg1] = "MIN")

or ([Department2] = [Select Department] and [primprg2] = "MIN")

or ([Department3] = [Select Department] and [secnprg1] = "MIN")

or ([Department4] = [Select Department] and [secnprg2] = "MIN")

THEN "Minor"

END

Am assuming I need to write something like: If Department1 = [Select Department] and (primprg1 <> "MIN"

or primprg1 = "NULL")

... but how do I express the thought primprg = "Null"?  in Tableau language ... in SPSS it's = ""   but that doesn't work for me here.

Any help greatly appreciated,

Ash

• ###### 1. Re: Can you specify Null values in IF/THEN/ELSE/END?

Ash,

There may be some complexity to the question that I'm not seeing right off, but try the ISNULL function:

something like

...

or ISNULL(primprg1)

...

Regards,

Joshua

• ###### 2. Re: Can you specify Null values in IF/THEN/ELSE/END?

That's exactly what I needed--no complexity here, just uncertain how to express that.

It worked perfectly.

Very grateful,

Ash