Alteryx Designer Desktop Discussions

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

How to Modify Cell Data That Occurs in Multiple Columns?

shaheer
8 - Asteroid

Hello,

 

I am extracting data from a very large excel file. After rearranging names which are in "[lastname], [firstname]" formatting, an example of the extraction looks like this:

 

Name1AgeManager1Manager2
Jamie Jones40Anna BelleMary-Ann Lou
Roger Frank20Mary-Ann LouAnthony Bjornik

 

Out of all of the names, I just want to modify "Mary-Ann Lou" such that her name becomes "Mary Lou", removing the hyphen and the name after it. I have tried using the replace tool but haven't been able to do it successfully. Find and replace only looks at one certain column to find and replace, but this name appears in several. I could make one for every column but that seems inefficient. How shall I go about this?

5 REPLIES 5
Matthew
11 - Bolide

a simple regex replace should work


REGEX_Replace([Field1], '-\w*', '')

Matthew_0-1665080739676.png

 

shaheer
8 - Asteroid

If I want this to work for multiple columns, would I just add them into the REGEX formula? For example,

 

REGEX_Replace([Field1],[Field2],[Field3] '-\w*', ''). This name appears in multiple columns. Also, I wish to replace the name, not create a new column for it.

Matthew
11 - Bolide

just add a new formula for each column you want to do this to

yes, formulas can write over existing columns instead of creating new columns

 

Matthew_0-1665081654717.png

 

shaheer
8 - Asteroid

Didn't even notice that, thank you so much!

MilindG
12 - Quasar

MilindG_0-1665083818707.png

@shaheer You can also use Multi-Fiels Formula tool if you need several columns needs to be changed.

Labels