We have a formula field in a custom object that does not calculate properly. Although the value of the field in the if condition is not null, the result is always zero. The formula is:

if(field1__c!=null,field2__c - field3__c,0)

try changing it to

IF(ISBLANK(field1__c), 0 , field2__c - field3__c)

its always better to use the inbuilt formula functions..

you can refer this link to understand the difference between ISNULL and ISBLANK functions

  • Thanks Vamsi That helped. Any idea why that wouldn't work without giving any errors?
    – Jorjani
    Jan 8 '16 at 1:59
  • I think != null doesn't cover empty strings ( != '' ) ISBLANK covers both the checks. Jan 8 '16 at 2:16
  • More to the point, text fields are not NULL in formula terminology. Only other non-text types, like numbers and dates, can be null. ISBLANK, however, covers both the null case (like dates and numbers) as well as empty text strings.
    – sfdcfox
    Jan 8 '16 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.