Can I return two different data types in formula field based on some criteria?

Say I have a Formula1__c field with a percent return type, and Roll_up Summary__c field that counts all detail records wherein Picklist__c value = 'A'.

There's a requirement that if Roll_up Summary__c > 0, a formula field with text return type named Result__c must be equal to A, while if Roll_up Summary__c = 0, Result__c must be equal to Formula1__c.

Please bear with me, and thanks in advance.

  • 2
    Why not return a text in both scenarios? – Raul Mar 9 '18 at 10:40

Formula should always return selected type.

In your case I would either: Create formula and depending on conditions return parsed values (there are functions for that eg TEXT() VALUE()) or create two formula fields each working with desired requirements.

| improve this answer | |
  • i've tried TEXT(Formula1__c) but it just returns zero. Would not it get the exact value of Formula__c? Say its value is 100%. Isn't it possible to get it in that state? – Gaynerys Mar 9 '18 at 10:59

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.