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
Gary YantsosGary Yantsos 

FIND / MID / RIGHT Formula?

Hi. I've tried a few things, but I'm not getting the result that I'm hoping for. I'm trying to extract a fixed length string from a substring. Problem is that the string I'm looking for is not always in the same position in the substring. For example, see the string below. I want to extract "ECN_nnnn" from this. However, the letters "ECN_" isnt always in the same spot.  There will always be 4 characters to the right of "ECN_"

DOCUMENT APPROVAL: ECN_1053 - Auto Refractors Portuguese Labeling for Brazil

I think I'm using FIND and RIGHT, but cant get the syntax right. Thanks!
shailesh_rawteshailesh_rawte
Hi Gary Yantsos

Ref belowe link.
https://success.salesforce.com/answers?id=9063A000000pCPEQA2
Gary YantsosGary Yantsos
Thanks. I'm a bit closer, with this formula.

MID( dsfs__Subject__c ,
    FIND("ECN_",dsfs__Subject__c)+LEN("ECN_")
    ,FIND("-",dsfs__Subject__c) - FIND("ECN_",dsfs__Subject__c) - LEN("ECN_") + 4
)

Here's the string (dsfs__Subject__c)
DOCUMENT APPROVAL: ECN_1053 - Auto Refractors Portuguese Labeling for Brazil

Here's the result of the formula
1053 - Au

I need to extract "ECN_1053" from the above (as an example)