You need to sign in to do that
Don't have an account?
Linda 98
Trim left and right parts of string in IF
I am using a Workflow field update and having IF conditions in it.
I want to trim left(6) and right(20) parts
My example is
'You can call on: 123456789 -thank you'
this is my string of which i want only 123456789
IF(BEGINS(Info,'You can call on: '),RIGHT(info,LEN(info) -15),
info))
This is giving me '123456789 -thank you'
I am struck with errors here.(If is not allowing me more than 3 conditions) Pointers please.
I want to trim left(6) and right(20) parts
My example is
'You can call on: 123456789 -thank you'
this is my string of which i want only 123456789
IF(BEGINS(Info,'You can call on: '),RIGHT(info,LEN(info) -15),
info))
This is giving me '123456789 -thank you'
I am struck with errors here.(If is not allowing me more than 3 conditions) Pointers please.
Hi Linda,
I don't really see the the point of using IF in this particular scenario. But if you really want to use IF then you can do something like this.
IF(Put your condition here,
MID(
Info,
FIND(":",Info)+1,
FIND("-",Info)-FIND(":",Info)-1
),
' '
)
To better understand the behaviour of IF refer to this link: https://help.salesforce.com/articleView?id=customize_functions.htm&type=5
Let me know if it helps.
Thanks
All Answers
Try something like below,
IF(BEGINS(Info,'You can call on: '),LEFT(RIGHT(info ,LEN(info ) -16),10),info))
best regards
IF(
CONTAINS(Info,'You can call on:') && CONTAINS(Info,'-thank you'),
MID('You can call on: 123456789 -thank you',18,9),'NULL'
)
This will work for the example you mentioned giving you the 9 digits.
Though your scenario is not making much sense to me. I might be to able to help you better if you can explain your requirement more clearly.
IF(BEGINS(Info, 'You can call on'),RIGHT(LEFT(Info,27),10),'')
Adjust the digits according to your value in Info.
i tired them but they are not working.All my values are not same always.
'You can call on: 767578697878768759765 -thank you
its not the number always.It might contain text also like
you can call on: 7677363737 ext 768 -thank you
I am trying to trim the center part and update it in custom field. YOu can call on: and -thank you are same always.
Use nested SUBSTITUTE( ) moreover to remove the fixed values.
SUBSTITUTE(SUBSTITUTE(text, " -thank you","")," call on:","")
SUBSTITUTE(text, old_text, new_text) and replace textwith the field or value for which you want to substitute values,old_text with the text you want replaced, and new_text with the text you want to replace the old_text.
But your big problem is still the characters in the middle of the numbers like " ext " or " foo" or anything else that you don't know.
MID(
Info,
FIND(":",Info)+1,
FIND("-",Info)-FIND(":",Info)-1
)
Note: This will only give the expected results when there is no ':' or '-' between ' you can call on:' and '-thank you'.
Let me know if this helps.
Thanks.
Try this out,
TRIM(SUBSTITUTE(SUBSTITUTE( Info , '-thank you', ''),'You can call on: ',''))
i am having error when i use it .
as i am having other conditions,i am using IF
Can i use this in IF.I am having expected 3 but received 1 even i am using correct ()
Hi Linda,
I don't really see the the point of using IF in this particular scenario. But if you really want to use IF then you can do something like this.
IF(Put your condition here,
MID(
Info,
FIND(":",Info)+1,
FIND("-",Info)-FIND(":",Info)-1
),
' '
)
To better understand the behaviour of IF refer to this link: https://help.salesforce.com/articleView?id=customize_functions.htm&type=5
Let me know if it helps.
Thanks
Hi,
Please try the below one:
Workflow Rule:
Rule Criteria : CONTAINS( image_te1__c ,'You can call on:') && CONTAINS(image_te1__c,'-thank you')
Field Update:
Phone field : MID('You can call on: 123456789 -thank you',18,9)
Text field : VALUE(MID('You can call on: 123456789 -thank you',18,9))
Kindly let me know will it works!
Thanks,
Jenefa
Sweet Potato Tec
IF( BEGINS(Info,'You can call on: '),MID(Info,FIND("You can call on: ", Info)+16 ,
(FIND("-Thank you", Info )-10) - (FIND("You can call on: ",info ))),Info)
Thank you all.