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
Prafulla PatilPrafulla Patil 

How to extract values using Salesforce Formula fields

I have one Text field on Custom Object as follows -

 

Product_Info__c = 'DESKTOP:10,LAPTOP:20,MOUSE:20,PHONE:25' //sample value

 

I want to create new formula field as DesktopCount__c which will result value as 10 in above case.

 

DesktopCount = 10

LAPTOPCount = 10 .. etc

 

Note: I can do this apex but wanted to check if its possible to do using formulas.

Vinita_SFDCVinita_SFDC

Hello,

 

If the field value is always goin to start with Desktop:10(a two digit number) then we can write formula like:

 

NUMBER(RIGHT(LEFT(Product_Info__c,10),2))

 

So this will return 10 of number format.