Pretty simple request that I can't seem to get working.
I have data that varies in length, but there is a hyphen and I only want what's before the hyphen. I'm guessing I should be using a Formula tool?
EXAMPLE: Factory Cost Centers-Business Admin....all I want is Factory Cost Centers. The hyphen always defines the split.
Thanks in advance!!!
Solved! Go to Solution.
Hi @mattcoleman,
You can use the RegEx_Replace() function within the formula tool to do so. Here's the expression:
REGEX_REPLACE([Field],'^(.+?)-.*$','$1')
Without going too much into details, this regex is saying from the start of the string, capture all characters until it finds the first '-'.
Hope this helps!
Jimmy
Worked perfectly, thanks Jimmy!
Without REGEX you could try
Left([Field],Findstring([Field],'-'))
That will find the character number of the hyphen and take the left characters before it