community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Greater Than in Formula Tool

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!

Alteryx Certified Partner

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

Asteroid

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

Nebula
Nebula

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

 

 

Labels