[SalesForce] Text formula to return characters between two “.” characters

I'm trying to create a formula field that returns a number. The source of the field is a text value such as the following examples.

  • 0.0.004.0

  • 1.24.004.0

  • 3.336.004.0

  • 4.672.002.0

The goal is to store the values in bold above in the formula number field. I believe this is possible with a couple text functions (Begins, Find, Left and Right) wrapped in a Value function to return the number represented by the text highlighted above.

Can you solve this?

Best Answer

The following should do the job.

It finds the position of the first . in the string. Then finds the position of the first . in the rest of the string and uses MID and a slight offset to pick out the value from between the two positions.

VALUE(
  MID(
    YourField__c, 
    FIND(".", YourField__c) + 1, 
    FIND(".", RIGHT(YourField__c, LEN(YourField__c) - FIND(".", YourField__c)))
  )
)