Alteryx Designer Desktop Discussions

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

Greater Than in Formula Tool

grsomer
8 - Asteroid

Hi! 

I am trying to create a function in the formula tool that says: If Feild 1 is greater than 10 000, then leave as is, else make blank. My snytax looks like this: if [Book_Attr.GL Company] >= 10000 then [Book_Attr.GL Company] else "" endif . 

I am receiving the error: Invalid type in operator >= . Is there something wrong with my snytax or another way to write a greater than function?

Thanks!

4 REPLIES 4
LordNeilLord
15 - Aurora

Hey @grsomer 

 

Check [Book_Attr.GL Company] is coming through as a number and not a string

 

If that fails, "" is a string so Null() would be better

grsomer
8 - Asteroid

Null() worked much better, thanks so much!!

danilang
19 - Altair
19 - Altair

Hi @grsomer 

 

The type mismatch error is probably caused by [Book_Attr.GL Company] being a string and your formula comparing it to a number.  change your formula to this 

 

if ToNumber([Book_Attr.GL Company]) >= 10000 then [Book_Attr.GL Company] else "" endif . 

 

 

If you change the 10000 to a string like this

 

if [Book_Attr.GL Company] >= "10000" then [Book_Attr.GL Company] else "" endif . 

 

Your error will disappear but you'll get cases where "2000" is greater than "10000" because the >= is using an alphabetical comparison

 

Dan

 

 

Vaibhav0208
5 - Atom

I am trying to make a formula where I have to apply Greater Than formula between two columns like [ABS]>[Right Amount], but it is showing error, How to do?

Labels