Syntax help

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

Syntax help

Post by matthewR »

I have the following. Not sure if my syntax is correct.

IIF ([Current District] <> [Baseline District], [Current District] or IIF[Current District] is null,[Baseline District], [Current District])

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

Re: Syntax help

Post by HansV »

Does this do what you want?

Nz([Current District], [Baseline District])
Best wishes,
Hans

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

Re: Syntax help

Post by matthewR »

There are two different scenarios - current District and baseline District are two different names - I want Current. If Current is null, I want baseline. Will that formula cover this or am I making this harder than it is?

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

Re: Syntax help

Post by HansV »

NZ(a, b) will return a unless a is Null, then it will return b. So Nz([Current District], [Baseline District]) will return [Current District], unless that is Null, then it will return [Baseline District].
Best wishes,
Hans

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

Re: Syntax help

Post by matthewR »

Thanks Hans. That worked fine.