This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Hi All,
I have been trying to remove everything after first - from the right of a string including the -
Example My string has
INPUT: Output;
ABC-DEF-GHI ABC-DEF
JHX-HZXE JHX
HDKDK12-HJDJ-7695 HDKDK12-HJDJ
Requirement is to always remove everything from the first - right of the string.
I have tried Right([account], FindString([account], '-')) and some regex functions but nothing is giving me the right result.
Let me know if anyone can help.
Regards,
Rahul
Solved! Go to Solution.
I would use Text to Columns and split on "-". You only need to split to two fields and the result you want will be in the first field while everything else will split out into the second field.
Hi,
Here's a regular expression that should work:
(.*)-[^-]*
This will output all data before a dash that has only non-dash characters after it.
Additionally, a formula option is below:
Left([Account],Length(Account)-FINDSTRING(ReverseString(Account),'-')-1)
This will take the left characters up until a character before the last "-" in the string, thanks to ReverseString.
Hi Claje,
Both the solutions worked in my case.Thank You.
I was probably not reversing the string.
Regards,
Rahul Shetty
Hi Sruhl,
I had laready tried this one.The problem with this one was the split in to first and second was not what I required.
For example -- output was getting split after the first hyphen.
Regards,
Rahul
Hi Ponraj,
This looks like a good hack for my question. Thanks very much.
Regards,
Rahul
@rahulshetty925I see, I missed that important piece. I'm glad you got a solution.
hey can u pls share your solved code ..becoz your .yxmd file is not opening ...share in notepad or readable format