function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Edward StanawayEdward Stanaway 

Bringing an integer into an IF statement

Hi,

I'm trying to wrap my head around a particular problem.   We have some number fields, and these fields need to produce 2 things:  The number entered if they are filled out, and if they are not filled out a -1 answer.

So far I am using the following statement, which accomplishes 1/2 the job (getting -1 as an answer if blank).   Does anyone know how to bring the entered number into the results, should the field be filled out?

IF(ISBLANK(My_number field), '-1', '0')

Thanks for any leads.
Best Answer chosen by Edward Stanaway
VinojVinoj
Sorry missed that!  This should do it:
 
IF( ISBLANK( My_Number_Field__c ) , '-1',  TEXT(My_Number_Field__c) )

 

All Answers

VinojVinoj
Hi Edward,

Would this work for you?
 
IF( ISBLANK( My_Number_Field__c ) , -1, My_Number_Field__c )

Let me know if I misunderstood the question.
Edward StanawayEdward Stanaway
Sadly no.  The logic used requires text.

Error: Incorrect parameter type for function 'IF()'. Expected Text, received Number
VinojVinoj
Sorry missed that!  This should do it:
 
IF( ISBLANK( My_Number_Field__c ) , '-1',  TEXT(My_Number_Field__c) )

 
This was selected as the best answer
Muralidhar SingriMuralidhar Singri
I believe you have to make it of type string and then it should work. Try this:
IF( ISBLANK string('( My_Number_Field__c ), ' + '-1', + 'My_Number_Field__c' ))