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
Aaliya Yusufzai

# Formula Currency field

Hi,
I'm trying to create a formula field.
If a picklist value is "Monthly", then take the currency field of "Total" and divide that by 12 to show the value
​If a picklist value is "Annual", then take the currency field of "Total" and divide that by a number field 1 to show the value
f a picklist value is "SemiAnnual", then take the currency field of "Total" and divide that by a number field 2 to show the value

I'm not sure how to do this.
Best Answer chosen by Aaliya Yusufzai
Akhil Anil
Hi Aaliya,

Your formula will be simply this

CASE(Picklistfield__c,
"Monthly",(Total__c/12),
"Annual",(Total__c/Field1__c),
"SemiAnnual",(Total__c/Field2__c),
NULL
)

OR you can also write the same logic in a different way using nested IFs like below

IF(
TEXT(Picklistfield__c) = "Monthly",
(Total__c/12),
IF(
TEXT(Picklistfield__c) = "Annual",
(Total__c/Field1__c),
IF(
TEXT(Picklistfield__c) = "SemiAnnual",
(Total__c/Field2__c),
NULL
)
)
)

I would recommend you to go with the CASE approach.

Use the insert field option to use the right API names of the fields.

Kindly mark it as an answer if that works.

Akhil Anil
Hi Aaliya,

Your formula will be simply this

CASE(Picklistfield__c,
"Monthly",(Total__c/12),
"Annual",(Total__c/Field1__c),
"SemiAnnual",(Total__c/Field2__c),
NULL
)

OR you can also write the same logic in a different way using nested IFs like below

IF(
TEXT(Picklistfield__c) = "Monthly",
(Total__c/12),
IF(
TEXT(Picklistfield__c) = "Annual",
(Total__c/Field1__c),
IF(
TEXT(Picklistfield__c) = "SemiAnnual",
(Total__c/Field2__c),
NULL
)
)
)

I would recommend you to go with the CASE approach.

Use the insert field option to use the right API names of the fields.

Kindly mark it as an answer if that works.
This was selected as the best answer
Aaliya Yusufzai
Thank you again Akhil!
Aaliya Yusufzai
Akhil, If I want to change the formula to always populate the Total__c field, but only change if Field1__c contains 12 or 6, then how can I do this.