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
Lorenzo WilliamsonLorenzo Williamson 

Substitute Formula

Hi Guys,

I'm using a formula field to replicate the value of another field, but also to remove the first two characters if they equal "00", I'm having trouble with this, problem being it removes "00" regardless of where it is positioned. Example below;

Original value: 007985887100
What i currently get back: 79858871
What i would like to get back: 7985887100

Any help would be much appreciated.

Thanks
Lorenzo
 
Best Answer chosen by Lorenzo Williamson
Shashikant SharmaShashikant Sharma
Use this formula :
 
IF( LEFT(Field_API_Name__c, 2) == '00', RIGHT(Field_API_Name__c, LEN(Field_API_Name__c) -  2), Field_API_Name__c)

Use the Field API Name of the field that you want to use where Field_API_Name__c is mentione din the formula

All Answers

Shashikant SharmaShashikant Sharma
Use this formula :
 
IF( LEFT(Field_API_Name__c, 2) == '00', RIGHT(Field_API_Name__c, LEN(Field_API_Name__c) -  2), Field_API_Name__c)

Use the Field API Name of the field that you want to use where Field_API_Name__c is mentione din the formula
This was selected as the best answer
PuneetsfdcPuneetsfdc
Hi Lorenzo,

try this formula where Test__c is your field storing value ( 007985887100 ),
my formula field Data type is Text and I assume Test__c Data type is also text
 
IF( CONTAINS( LEFT(Test__c, 2), "00" ),
       TRIM(RIGHT(Test__c, (LEN(Test__c) - 2  ) ) ),
            Test__c)


If my answer helps you to solve your problem please mark it as best answer.
Lorenzo WilliamsonLorenzo Williamson
Thank you Shashikant and Puneetsfdc, very much appreciated. Both of your formulas worked, unfortunately I can only mark one as the best answer so I will have to go with the first one that was submitted. 

Thanks again guys, I knew I could rely on your expertise.