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
Yvonne-Ban-AirYvonne-Ban-Air 

Help - Amount Calculation Formula

I would like to achieve below calculation:

 

If Stage Name = "Submit"

 

Total Amount=Goods Amount + Delivery Amount + Installation Amount

 

Formula:

 

Total Amount= IF( ISPICKVAL(StageName, "Submit"),  (Goods_Amount__c+Delivery_Amount__c+Installation_Amount__c), 0)

 

This formula has no error, but cannot trigger the result.  Any idea? Thank you.
Best Answer chosen by Admin (Salesforce Developers) 
Yvonne-Ban-AirYvonne-Ban-Air

Hi Mark 

 

I have got it working. Thank you so much for your help!!

 

 

All Answers

MarkSilberMarkSilber

Your formula should work as is, but as a sanity check, remove the extra parentheses around the fields you are adding. The result should look like this:

 

 

IF(ISPICKVAL(StageName, "Submit"), Goods_Amount__c+Delivery_Amount__c+Installation_Amount__c, 0)

 

 

Message Edited by Mark Silber on 07-28-2009 05:47 AM
Yvonne-Ban-AirYvonne-Ban-Air

I have just tried it, but it came up with this message:

 

 

Error: Formula result is data type (Number), incompatible with expected data type (true or false).

 

 

Please advise.

MarkSilberMarkSilber
What is the field type of the formula field? It should be Currency.
Yvonne-Ban-AirYvonne-Ban-Air

Yes, they are currency fields.

 

 

 

I tried to set a formula for commission calculation the other day, I found this example from Salesforce user guide. I tried to copy it, however, it doesn't work. I can't figure out the reason.

 

IF(ISPICKVAL(StageName, "Closed Won"),

ROUND (Amount *0.02, 2), 0)

 

 

MarkSilberMarkSilber
What I meant to ask is if the formula field is a Currency field, not the fields you are adding. What is the error (if any) you are getting or issue with the formula you just posted?
Yvonne-Ban-AirYvonne-Ban-Air

Sorry for the confusion.

 

I have no idea whether the formular field is a Currency field. Could you please advise how can I make sure of this?

 

The error is for the initial post (Total Amount). Please ignore my previous post ( Commission Calculation). They are different cases.

Yvonne-Ban-AirYvonne-Ban-Air

Additional information for you, hope it helps:

 

 

I added the formula as Validation rule under the Opportunity field- Total Amount (Currency).

 

The other fields - Goods Amount, Delivery Amount and Installation Amount, also currency fields in the Opportunity page.

MarkSilberMarkSilber
When you created the formula field, it gives you some options to pick the field type (Currency, Date, Date/Time, Number, Percent or Text). If you look at the list of fields for your object, you can see what type next to the field. It will say Formula(field type). If it isn't a currency field, you can change it.
MarkSilberMarkSilber
You would actually need to create a new formula field, not a Validation Rule. Validation Rules are used to stop the save of a record based on some condition. Formula fields can be used on page layouts, list views and reports.
Yvonne-Ban-AirYvonne-Ban-Air

Hi Mark 

 

I have got it working. Thank you so much for your help!!

 

 

This was selected as the best answer