1

I have two fields in Salesforce. One is a currency and one is a percentage field. I have a third formula (text) field that I want to show the value of the currency or the percentage based on an IF statement. When I convert the percentage field to Text I get ".2" vs 20%. Is there a way to have the value show as 20% vs. ".2"? Below is my If Statement

IF(
    ISPICKVAL(Discount_Value_Type__c, "Fixed"), 
    TEXT(Promotion_Discount__c), 
    IF(
        ISPICKVAL(Discount_Value_Type__c, "Percent"),
        TEXT(Discount_Percentage__c), 
        "0"
    )
)

1 Answer 1

1

Yes there is. You just have to do some more processing to Discount_Percentage__c

  • multiply it by 100
  • then convert it to text
  • then append the '%' symbol

you can append two strings in a formula using either + or &. e.g.

'One String' + ' ' + 'Two String' + ' '  + 'Red String' + ' ' + 'Blue String'

Using & would probably be better here to avoid confusing it for addition (since you'll be multiplying)

3
  • And that can all happen in the IF formula? Commented Nov 17, 2023 at 20:49
  • @KateColson Yes. As long as you end up with the expected result type (e.g. the first argument to the IF() must be a boolean, a true/false), and you respect the types that operators and functions need (e.g. not trying to multiply two dates, not passing a boolean into DATEVALUE() which expects a datetime or a string), then you can do pretty much whatever.
    – Derek F
    Commented Nov 17, 2023 at 20:54
  • 1
    AHHMazing that worked!!! Thank you so much Commented Nov 17, 2023 at 20:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .