ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Trim right digits after last -

kas
8 - Asteroid

Hello,

 

I am using the formula below in a formula tool, but in instances where there are double digits after the last dash, it only removes one. (if I put 2 it will remove the "-" when a single digit). Have tried several different ways without success. Tried a RegEx, but I'm not the most versed with them and didn't get it quite right either.

 

TrimRight([Name],Right([Name], 1))

 

 

 

Current Desired
   
   
Name Name
Fund-Number-9 Fund-Number-
Fund-Name-9 Fund-Name-
Fund-Type-9 Fund-Type-
Fund-Transaction-Amount-9 Fund-Transaction-Amount-
Fund-Units-Sold/Purchased-9 Fund-Units-Sold/Purchased-
Fund-Ending-Units-9 Fund-Ending-Units-
Fund-Unit Val-9 Fund-Unit Val-
Fund-Ending-Value-9 Fund-Ending-Value-
Fund-Number-10 Fund-Number-
Fund-Name-10 Fund-Name-
Fund-Type-10 Fund-Type-
Fund-Transaction-Amount-10 Fund-Transaction-Amount-
Fund-Units-Sold/Purchased-10 Fund-Units-Sold/Purchased-

 

Thank you,

Kim

2 REPLIES 2
ChrisTX
16 - Nebula
16 - Nebula

Try this in a Formula tool

 

REGEX_Replace([Name], "(.*-).*", "$1")

 

kas
8 - Asteroid

@ChrisTX - works like a charm...thanks so much for the quick solution!

Labels
Top Solution Authors