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

Formula to Compare two fields and return a value

I think I might be suffering with cabin fever, so there's nothing left to do but to consult the Oracles.....


Basically I have custom object that contains an Account Lookup field as well as contact lookup field. I would like to create a formula field that compares the the CustomObject.AccountId with the Contact.AccountId field and return a value i.e. Matched or Mismatched.


This will then be used to report and thus a user action taken in the event of a user changing the contact changing Contact.AccountId




Steve :-/Steve :-/

Have you tried something like this?


IF(CustomObject.AccountId = CustomObject.Contact.AccountId, "Match","Mismatch")

or if you want to make sure they match you can just create a Validation Rule like this


CustomObject.AccountId <> CustomObject.Contact.AccountId





Hi Steve,


Many thanks for this.....I have a minor issue with my formula field and the following:


IF( Account__c  =  Contact__r.Account.Name, "Matched", "Unmatched")

Where Account__C is the Account Lookup field on the custom object

Contact__r.Account.Name is the Account field within the contact record



Regardless of whether the two values are equal or unequal, "Unmatched" is always displayed in the field.



Steve :-/Steve :-/

Try using this formula  


IF(Account__r.Id = Contact__r.Account.Id,"Account Match","Account Mismatch")

What is the relationship between each of the objects?  Master-Detail, or Lookup? 





Standard Lookup field.....


I think I might know what's coming!!!

Steve :-/Steve :-/

Well if you guessed "You owe me a beer!" then you'd be right.