Ask Search:
Courtney WestonCourtney Weston 

If Formula field with Custom Record Types

I have a formula field on a custom object that multiplies one field by another to get the number that is our target goal. This field has a different equation based on the object record type. The below formula does not have any errors, but it is leaving the field blank.

IF(Id = '012E0000000oQoN', ((Registered_Hoteliers__c  * 3)*(1+ Historical_Attrition__c )),
IF(Id = '012E0000000oQoO', ((Registered_Hoteliers__c  * 2)*(1+ Historical_Attrition__c )), null
)
)


I need objects with record type ID = 012E0000000oQoN to have the formula (Registered_Hoteliers__c  * 3)*(1+ Historical_Attrition__c ).

Record type ID = 012E0000000oQoO should have the formula (Registered_Hoteliers__c  * 2)*(1+ Historical_Attrition__c )

Any help is appreciated!
Best Answer chosen by Courtney Weston
Tom HoffmanTom Hoffman
Try this, think it should work + if the criteria doesn't match, we'll have a 0 there instead of a null value as an indicator. 

IF(Text(Type__c) = 'Showcase', ((Registered_Hoteliers__c  * 3)*(1+ Historical_Attrition__c )),
IF(Text(Type__c) = 'Summit', ((Registered_Hoteliers__c  * 2)*(1+ Historical_Attrition__c )), 0
)
)

All Answers

Tom HoffmanTom Hoffman
Hey Courtney - is that your exact formula? If yes, I think you might be referencing the record id, not the record type id.  It's also a best practice to avoid hardcoding your record type ids, so might can try the below to use the label.  Let me know if this works for you!

IF(RecordType.Name = 'Record Type label', ((Registered_Hoteliers__c  * 3)*(1+ Historical_Attrition__c )),
IF(RecordType.Name = 'Record Type label', ((Registered_Hoteliers__c  * 2)*(1+ Historical_Attrition__c )), null
)
)
Till KlotzTill Klotz
Hi Courtney,

try using the 18 digit ids for the record type field:

012E0000000oQoN = 012E0000000oQoNIAU
&
012E0000000oQoO = 012E0000000oQoOIAU

If that does not work, make sure the setting on formula is "Treat Blank Fields as Zeros"

Cheers,
Till
Courtney WestonCourtney Weston
The equation is different based on a picklist field - not record type as I previously thought. I've tried inserting IF(ISPICKVAL(Type__c = 'Type label')) but no luck.
Tom HoffmanTom Hoffman
can you copy & paste your exact formula? 
Courtney WestonCourtney Weston
IF(ISPICKVALType__c = 'Showcase', ((Registered_Hoteliers__c  * 3)*(1+ Historical_Attrition__c )),
IF(ISPICKVALType__c = 'Summit', ((Registered_Hoteliers__c  * 2)*(1+ Historical_Attrition__c )), null
)
)
Tom HoffmanTom Hoffman
Try this, think it should work + if the criteria doesn't match, we'll have a 0 there instead of a null value as an indicator. 

IF(Text(Type__c) = 'Showcase', ((Registered_Hoteliers__c  * 3)*(1+ Historical_Attrition__c )),
IF(Text(Type__c) = 'Summit', ((Registered_Hoteliers__c  * 2)*(1+ Historical_Attrition__c )), 0
)
)
This was selected as the best answer
Courtney WestonCourtney Weston
That worked! Thank you!!