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
praveen yadavalli 27praveen yadavalli 27 

Formula with trim

Hi I have small requirement  i have 2 text fields Textfield1 and fTextield2 now Textfield1 consists praveen_o6 and Textfield2 consists _o6 now output should come in the other field as praveen because it should trim the values from field1 since the value matches the field 2 

is there possibility 
Name &" "& Geo_Suffix__c this is existing formula which i am using now to combine both fields 1 & 2 but i need to compare and trim the value 
show it in field3 
Input: Territory Name: AMER_PS_PBU2_AD_SI1_06

Geo Suffix: 06

Out put: AMER_PS_PBU2_AD_SI1
Best Answer chosen by praveen yadavalli 27
GarryPGarryP
You can use combination of LEN, LEFT and RIGHT function
here is the example which works --
Assume MainCompetitor is your geo Suffix
CurrentGenerators__c is Territory Name
IF(MainCompetitors__c==RIGHT(
							CurrentGenerators__c,
							LEN(MainCompetitors__c)
							)
   ,
   LEFT(
		CurrentGenerators__c,
		LEN(CurrentGenerators__c)-LEN(MainCompetitors__c)
		)
	,
'No Match Found')

 

All Answers

GarryPGarryP
You can use combination of LEN, LEFT and RIGHT function
here is the example which works --
Assume MainCompetitor is your geo Suffix
CurrentGenerators__c is Territory Name
IF(MainCompetitors__c==RIGHT(
							CurrentGenerators__c,
							LEN(MainCompetitors__c)
							)
   ,
   LEFT(
		CurrentGenerators__c,
		LEN(CurrentGenerators__c)-LEN(MainCompetitors__c)
		)
	,
'No Match Found')

 
This was selected as the best answer
praveen yadavalli 27praveen yadavalli 27
User-added imageUser-added image
thanks very much its working fine but the main issue is if input terrototy name and geo suffix matches then it shoud remove geo suffix and output should come the remaining name this is working perfect but when coming to second scenario if they dont match then output should come as just whet ever present in the input territory name now its coming blank 
GarryPGarryP
IF(MainCompetitors__c==RIGHT(
							CurrentGenerators__c,
							LEN(MainCompetitors__c)
							)
   ,
   LEFT(
		CurrentGenerators__c,
		LEN(CurrentGenerators__c)-LEN(MainCompetitors__c)
		)
	,
CurrentGenerators__c)