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
Brian Oconnell WPDBrian Oconnell WPD 

Formula to return Currency Code from a currency field

I would like a formula field to return the Currency Code (USD, EUR, JPY) from a field with datatype "Currency" on a custom object.  How can I do this?

Thank you
Sanjay Mulagada 11Sanjay Mulagada 11
Hey Brian, your question is not clear. So you need one formula field of data type - currency; which should return 3 values (USD, EUR, JPY)?
Brian Oconnell WPDBrian Oconnell WPD
I want the formula to return a text field.  The result might be "USD" if the currency field it references is "USD123,456".
Sanjay Mulagada 11Sanjay Mulagada 11
Brian, so you might want to use "LEFT" logic

your formula might look something like this
IF(
   LEFT($Currency,3)="USD", "USD",
   IF(
       LEFT($Currency,3)="EUR", "EUR",
        IF(
             LEFT($Currency,3)="JPY", "JPY",
           '')
      )
)

This formula will return USD if the first 3 letters from currency field starts with USD and the same with EUR and JPY.
Thank you.
 
Brian Oconnell WPDBrian Oconnell WPD
I cannot use the function LEFT on a field of type "Currency".