In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. 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.

Modifying string text and numbers into same columns

akumar2609
8 - Asteroid

Hi All,

 

I need support in the below query. I have 4 different columns (v-string data type). In this columns I have both numbers as well as text (in some of the places, we will have written as 'Blank' and on some of the places it will simply empty. Now I want if my data is in number then add % sign. For the text, for the -, for the Blank cells, I need the data as it is.

 

For example:-

 

CCM_ACCA_ACCM_BCCA_B
10 5.65.2
-Blank-5
-Blank  
5-120
10016  
58  

 

 

Required Result

CCM_ACCA_ACCM_BCCA_B
10% 5.6%5.2%
-Blank-5%
-Blank  
5%-12%0%
100%16%  
5%8%  
2 REPLIES 2
DataNath
17 - Castor
17 - Castor

Hey @akumar2609, you can use a Multi-Field Formula for this in order to handle multiple fields at the same time. The expression will look something like so:

 

if regex_countmatches([_CurrentField_],'\d') > 0 then [_CurrentField_]+'%' else [_CurrentField_] endif

 

Not sure why but Alteryx has changed the '-' to 0 in some of my records but the workflow still shows the expression in action. Hope this helps!

PhilipMannering
16 - Nebula
16 - Nebula

You can also use this expression in the Multi-Field Formula Tool,

if IsInteger(replace(ToString([_CurrentField_]), '.', '')) 
then ToString([_CurrentField_]) + '%' 
else [_CurrentField_] endif
Labels
Top Solution Authors