Is there is any option to return the value after '-'in a field.Suppose I have a field A in which the value is abc-technicalrecuiter but the position of '-' is different everytime. I want this field to return only technical recruiter in reports. Is it possible using LPAD,RIGHT OR LEFT fUNCTIONS ??

Kindly help!!

1 Answer 1


FORMULA Field for this could be like -

I dont know How much I am going correct - Try this out and let me know - if I am missing something -

Eg: Your_Field__c = abc-Team

LEN (Your_Field__c) = 8

FIND("-", Your_Field__c) = 3

RIGHT(Your_Field__c, (LEN(Your_Field__c) - FIND("-", Your_Field__c)-1))

= RIGHT(abc-Team, ((8-3)-1)) = RIGHT(abc-Team, 4) = Team

Final Formula will be :

RIGHT(Your_Field__c, (LEN(Your_Field__c) - FIND("-", Your_Field__c)-1))


Previous Answer (Using Apex Code)

Try this one with your Apex code

String s1 = 'abc-technicalRecruiter';
String s2 =  s1.substringAfter('-');

System.assertEquals('technicalRecruiter', s2); 

//here you verify that s2 contains your Job name only ( whatever comes after "-" symbol)

For More help checkout following String Methods in given Link

  • subString(index)
  • subString(startindex,endindex)
  • substringAfter(separator)
  • substringAfterLast(separator)
  • substringBefore(separator)
  • substringBeforeLast(separator)


  • 1
    Hi Nilesh,Thanks for your help but is it possible using formulaes,I don't want to use the code since I am the admin Oct 20, 2015 at 14:25
  • You mean you want to do it using "Formula Fields" ? Oct 20, 2015 at 14:31
  • Updated Answer, Check it out, let me know Oct 20, 2015 at 14:55
  • Look at MID() formula function for an alternative solution. MID does substring
    – cropredy
    Oct 21, 2015 at 1:32
  • 1
    Hi Nilesh,You are absolutely correct.Bang on the target!!Thanks man Oct 21, 2015 at 7:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .