We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Unique Column Headers

skotian1289
8 - Asteroid

Hi All,

 

I know this could be a simple solution but I need help as I am quite new to Alteryx.

 

My input file has 100s of column headers and some column headers are repeated multiple times. I want to give a unique numbers to each column headers because I want to reconcile them. In excel I am able to perform that step by using the below formula.

 

A2&"/"&COUNTIF(A$2:A2,A2)          (A2 value being 1)

 

See sample of what I am trying to achieve in alteryx, let me know if anyone can help me

 

Input File Column headers:

 

Blue     Green    Red   Blue    Red   Blue   Yellow    Green

 

Expected Resuts:

 

Blue/1     Green/1    Red/1    Blue/2    Red/2    Blue/3    Yellow/1    Green/2

 

Thanks

24 REPLIES 24
RolandSchubert
16 - Nebula
16 - Nebula

Hi @skotian1289 ,

 

Alteryx does a kind of "rename" on import adding a count to the header, but the result would not be exactly what you want (e.g. Green, Green1, Green2),

but of course you can add a unique identifier to your headers. I've added a sample workflow, let me know it if works for you.

 

Best,

 

Roland

vizAlter
12 - Quasar

Hi @skotian1289 — Are you looking for this:

 

vizAlter_0-1601272880026.png

 

Please mark it "Solved" or "Solved" with a Like if it resolved your query. This will help other users find the same answer/resolution.  Thank you.

grazitti_sapna
17 - Castor

Hi @skotian1289 , alteryx has the capability to rename duplicate fields of its own. Please refer to the screenshots.

grazitti_sapna_0-1601273600051.png

 

grazitti_sapna_1-1601273606901.png

Thanks.

 

Sapna Gupta
skotian1289
8 - Asteroid

Hi Viz Alter,

 

This is exactly what I was looking for however a small issue, when a column header is repeated for more than 9 times the column name changes to Blue9_/2 or Blue9_/3 . Is it possible similar to excel formula output the name captures Blue/10, Blue/11, Blue/12 , Blue/13 and so on ?

 

Thanks

 

 

grazitti_sapna
17 - Castor

Hi @skotian1289 , is this what you are looking for?

grazitti_sapna_0-1601275059731.png

 

If yes, then please mark this post as solution.

Thanks.

Sapna Gupta
vizAlter
12 - Quasar

@skotian1289 — Try this solution:

vizAlter_0-1601275497871.png

 

Please mark it "Solved" or "Solved" with a Like if it resolved your query. This will help other users find the same answer/resolution.  Thank you.

skotian1289
8 - Asteroid

Hi Viz Alter,

 

A quick question on the solution below, the Regex formula which you have used in your worklflow is not working for few samples like below cases.

 

Formula used: IF REGEX_Match([Name], "^[^0-9]+$") THEN [Name]+"1" ELSE [Name] ENDIF

                        REGEX_Replace([Name_new], "(.*)([0-9]+$)", "$1"+"/"+"$2")

 

Cases where the above formula is changing our headers completely.

 

1.) Original Header name:  User 1                 Post Formula header name: User/1         Instead of:  User 1/1

 

2.) Original Header name:  User 1 Name                 Post Formula header name: User 1  Name       Instead of:  User 1 Name/1

 

Apologies I am not a pro in regex expression, M I not using the formula correctly ?

 

Thanks

 

skotian1289
8 - Asteroid

@vizAlter 

 

A quick question on the solution below, the Regex formula which you have used in your worklflow is not working for few samples like below cases.

 

Formula used: IF REGEX_Match([Name], "^[^0-9]+$") THEN [Name]+"1" ELSE [Name] ENDIF

                        REGEX_Replace([Name_new], "(.*)([0-9]+$)", "$1"+"/"+"$2")

 

Cases where the above formula is changing our headers completely.

 

1.) Original Header name:  User 1                 Post Formula header name: User/1         Instead of:  User 1/1

 

2.) Original Header name:  User 1 Name                 Post Formula header name: User 1  Name       Instead of:  User 1 Name/1

 

Apologies I am not a pro in regex expression, M I not using the formula correctly ?

 

Thanks

atcodedog05
22 - Nova
22 - Nova

Hi @skotian1289 ,

 

Can you please try it out.

 

Input

atcodedog05_2-1601361672529.png

 

Output

atcodedog05_3-1601361690494.png

 

I feel this will be much more flexible then the regex.

 

Workflow

atcodedog05_4-1601361748714.png

 

 

Please check and let me know.

 

Hope this helps : )

 

Reply back if there is any issues.

 

Labels
Top Solution Authors