Hello Community,
Another "If" question:
If have used "Find and Replace" to add a column to a dataset showing "C.London" (as in Central London" to my dataset. The dataset covers all geographies in EMEA.
The remaining cells show as [NULL].
I would like to fill the remaining cells with either "R.UK" or "Other".
I have tried a number of if/elseif statements, using "NULL" and NULL() but in each case they seem to fail.
The latest attempt - where I have tried to create in FORMULA a new column containing either "C.London", "Rest.UK" or "Other" is this:
IF [CentralLondon] = "C.London" THEN "C.London"
ELSEif [CentralLondon] = "NULL" && [Country_tx] = "United Kingdom " THEN "Rest.UK"
Else "Other"
ENDIF
If it helps, CentralLondon and Country_Tx are V_String...
Again, thanks for the help...
DoC
Solved! Go to Solution.
There are a couple of ways to do this @DavidOliverChapman
ISNULL([Field])
or [Field] = NULL()
So your statement could be...
IF [CentralLondon] = "C.London" THEN "C.London"
ELSEif isnull([CentralLondon]) && [Country_tx] = "United Kingdom " THEN "Rest.UK"
Else "Other"
ENDIF
or
IF [CentralLondon] = "C.London" THEN "C.London"
ELSEif [CentralLondon] = NULL() && [Country_tx] = "United Kingdom " THEN "Rest.UK"
Else "Other"
ENDIF
You should use IsNull(Field) function.
IF [CentralLondon] = "C.London" THEN "C.London"
ELSEIF IsNull( [CentralLondon]) && [Country_tx] = "United Kingdom " THEN "Rest.UK"
Else "Other"
ENDIF
Cheers,
You're close! In your else statement, just change it to say isnull([FieldName]) instead of checking with the equals sign. This should help!
@BarnesK @BenMoss @Thableaus
Thanks for your help on this - absolutely brilliant.
DoC