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
AndyuxAndyux 

formula compare 2 fields and pick one

Need help with comparing and picking data - thanks!

So I have 2 fields that have numeral data (or maybe blank), FieldA and FieldB. I need a 3rd field FieldAB to populate with this data like this:
If field FieldA, has data, pick it.
If FieldA is blank, select that data from FieldB
If both blank, then FieldAB remains blank (NOT 0)

Something like
IF(
    AND(
        ISBLANK(FieldA__c),
        ISBLANK(FieldB__c)
    ),NULL,

    IF(
FieldA__c <> NULL, FieldA__c
FieldB__c <> NULL, FieldB__c
), NULL
)



 
Best Answer chosen by Andyux
AndyuxAndyux
IF( Not(ISNULL(FieldA__c )) , FieldA__c , IF( Not(ISNULL(FieldB__c )) , FieldB__c , Null ) )

 

All Answers

Manj_SFDCManj_SFDC
You can use the CASE operator in your formula 
AndyuxAndyux
IF( Not(ISNULL(FieldA__c )) , FieldA__c , IF( Not(ISNULL(FieldB__c )) , FieldB__c , Null ) )

 
This was selected as the best answer