Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Kassie Grecula

# If, Then Formula?

Hello! I can't seem to get the formula correct for an If, Then statement...

IF the Account's "Institution Type" (custom field) is a Bank or Commercial Bank, I want Calculation A to be used.
IF the Account's "Institution Type" is a Credit Union, I want Calculation B to be used.

Could anyone provide insight on how to write this? I get the basic jist, but everytime I "check syntax" something is always off. Thank you in advance!!
Best Answer chosen by Kassie Grecula
Jainam Contractor
Hi Kassie,

Can you please try the below formula:

```CASE( TEXT(Institution_Type__c) ,
'Bank', Custom_Field_A__c * (1/1000),
'Commercial Bank', Custom_Field_A__c * (1/1000),
'Correspondent Bank', Custom_Field_A__c * (1/1000),
'Holding Company', Custom_Field_A__c * (1/1000),
'Corporate CU', Custom_Field_B__c * 15,
'Credit Union', Custom_Field_B__c * 15,
NULL
)```

PS: Please change the API names of the Fields (Institution Type, Custom Field A and Custom Field B) according to your org.

Hope this helps. Please mark this as the solution if it solved your purpose. Please let me know if you need more assistance.

Thanks & Regards,
Jainam Contractor,
Salesforce Consultant,
Varasi LLC
www.varasi.com

Jainam Contractor
Hi Kassie,

I assume the result of the Formula would be of Number/ Currency type.

Say the resulting field is RESULT__c then, the formula would be as below:

RESULT_c = IF(OR(Institution_Type__c = 'Bank', Institution_Type__c = 'Commercial'), Formula for Calculation A, Formula for Calculation B)

I hope there are only 2 possibilities for the Institution Type custom field.

Please try the above formula and let me know if it helps.

Thanks,
Jainam Contractor,
Salesforce Consultant,
Varasi LLC
www.varasi.com
Kassie Grecula
Thank you Jainam! Yes - it is a currency type. The Institution Type custom field is a picklist, so it could be Bank or Commercial Bank; Credit Union or Corporate Credit Union, etc. There are a few others, but essentially there are not just 2 possibilities. In this case, would it be more complex?
Jainam Contractor
Hi Kassie,

Can you please provide all the possible picklist values for Institution Type and the Calculation for the values that you want the formula to work on.

It won't be much complex provided you send over the exact requirement that you are trying to achieve.

Thanks,
Jainam
Kassie Grecula
Sure, see below - those marked A would correspond with Calculation A, and B with Calculation B

(A) Bank
(A) Commercial Bank
(A) Correspondent Bank
(A) Holding Company
(B) Corporate CU
(B) Credit Union

Calculation A = 'Custom Field A' * .001
Calculation B = 'Custom Field B' * 15

Therefore, if any A's are chosen from the picklist, I want it to default to Calculation A, and same for B.
Jainam Contractor
Hi Kassie,

Can you please try the below formula:

```CASE( TEXT(Institution_Type__c) ,
'Bank', Custom_Field_A__c * (1/1000),
'Commercial Bank', Custom_Field_A__c * (1/1000),
'Correspondent Bank', Custom_Field_A__c * (1/1000),
'Holding Company', Custom_Field_A__c * (1/1000),
'Corporate CU', Custom_Field_B__c * 15,
'Credit Union', Custom_Field_B__c * 15,
NULL
)```

PS: Please change the API names of the Fields (Institution Type, Custom Field A and Custom Field B) according to your org.

Hope this helps. Please mark this as the solution if it solved your purpose. Please let me know if you need more assistance.

Thanks & Regards,
Jainam Contractor,
Salesforce Consultant,
Varasi LLC
www.varasi.com
This was selected as the best answer
Kassie Grecula
This worked! Thank you for writing it out for me - I really appreciate you taking the time. Wouldn't have been able to write that on my own!!!
Jainam Contractor
Great Kassie....

Happy to know that I was of some help to you...

Cheers...:) Let us know if you need any help from our end....

Regards,
Jainam Contractor
Varasi LLC
www.varasi.com