Correct Syntax for calculated column

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Correct Syntax for calculated column

Post by matthewR »

I need to create a column for the following:

If ([CLCLA_Eff_To_Dt] is not null or [CLCLA_Eff_To_Dt] < NOW()
then [AFFL] = "EXP" and [Assocname] = "" and [Assocnum] = "")

I am so bad at syntax.

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Correct Syntax for calculated column

Post by HansV »

That would be three calculated columns, I think.
What should be the result if the conditions are NOT met?
Best wishes,
Hans

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Correct Syntax for calculated column

Post by matthewR »

I am sorry, you are right. I would have to have 3 calculations - one for Affl, one for Assoc number and one for Assoc name. :sad:

So AFFLNew: IIf([CLCLA_EFF_TO_DT] is not null or [CLCLA_EFF_To_Dt] is < now(), "EXP",[AFFL])

I am not sure about the "is not null"

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Correct Syntax for calculated column

Post by HansV »

The first one would be

AFFLNew: IIf([CLCLA_EFF_TO_DT] Is Not Null Or [CLCLA_EFF_To_Dt] < Now(), "EXP", [AFFL])

If the other two follow the same pattern:

AssocNameNew: IIf([CLCLA_EFF_TO_DT] Is Not Null Or [CLCLA_EFF_To_Dt] < Now(), Null, [AssocName])

AssocNumNew: IIf([CLCLA_EFF_TO_DT] Is Not Null Or [CLCLA_EFF_To_Dt] < Now(), Null, [AssocNum])
Best wishes,
Hans