Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Text to columns, but keep the delimiter (positive negative)

dataviolet
7 - Meteor

Hi All,

 

I have data in one column that looks like this

 

E55-H55+M55
E10+I10+J10+K10+F10-H10-G10+M57
E10+F10+G10-H10+I10+J10+K10+M58
E10+F10+N9+O9+L10+M59
E10+I10+J10+K10+F10-H10+L10
E10-H10+F10+J10+L10

...

 

I'm trying to split that column to get something like:

E55 | -H55 | M55

 

(I want to keep the operation sign of whether the item is positive or negative). How can I go about doing this?

 

I thought about delimiting with the "+" but then that runs into an issue that I will then have to delimit multiple other columns, and it doesn't solve the issue of how to make sure the negative operator signs remains attached to the appropriate information. Would a Find/Replace tool be better?

4 REPLIES 4
Greg_Murray
12 - Quasar

Hi @dataviolet,

 

What about something like this.

 

Greg_Murray_0-1603304109558.png

 

Maskell_Rascal
13 - Pulsar

Hi @dataviolet 

 

I tried to build this as dynamic as possible, so there is a CReW Macro for deleting empty/null columns included in the workflow.

 

I'm first doing a Find/Replace to add a space before the positive/negative callout. Then using the space as my delimiter in the Text to Columns tool and splitting it to rows. This allows me to do another Find/Replace to get rid of any remaining "+" symbols in the data. I then flip the data back, use one more Text to Columns to split the data out into each individual column, and use the CreW Delete Empty Fields tool to remove any columns with no data. 

Maskell_Rascal_0-1603304841345.png

 

I've attached a copy of my workflow that includes the CReW macro if you want to give it a try. 

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Thanks!

Phil

 

dataviolet
7 - Meteor

Thank you, this is great. I had no idea the Regex tool could split to columns and rows like that.

dataviolet
7 - Meteor

thank you! this solution is great for people like me, who don't know how to use a Regex tool that well.

Labels