Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

IF THEN ELSEIF ELSE error

ppatane
8 - Asteroid

I am getting an error in the following formula:

 

IF Left([Firm Administrative Code 987654], 1) = 0 Then 'F00' ELSEIF

Left([Firm Administrative Code 987654], 1) = 4 Then 'F01' ELSEIF

Left([Firm Administrative Code 987654], 1) = 5 Then 'F05' ELSEIF

Left([Firm Administrative Code 987654], 1) = 8 Then 'F08'

ELSE 'F0 -ERROR'

 

ENDIF

 

The error occurs at the = sign before 8 in the 3rd to the last row

 

I have even tried copying the Left function from the previous row and pasting it over what I have and changing the condition, but it actually gives an error immediately. 

 

 

UPDATED: NM, it's vstring and needs quotes around the numbers after the = signs

3 REPLIES 3
Qiu
20 - Arcturus
20 - Arcturus

@ppatane 
Good to know it is now working.
The string generated from Left function has to be compared with a string, in your case, '5' 😁

flying008
14 - Magnetar

Hi, @ppatane 

 

A clear formula for you :

 

Switch(ToNumber(Left(ToString([Firm Administrative Code 987654]), 1)),'F0 -ERROR',0,'F00',4,'F01',5,'F05',8,'F08')
ppatane
8 - Asteroid

Wow, flying008!  I didn't know the Switch function. I like it!

Labels