Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

IF findstring and replace

ThePickleWizard
7 - Meteor

If I have three columns but am looking to write a formula IF findstring for column 1(IRON) with partial match data to column 3(SALES), but then, if there is a partial match, I want column 3 to replace the column 1 partial data. 

 

input:

IRONSUPPLYSALES
PO676334PO00902 545
PO112118PO67633 889
PO009021PO22123 221

 

 

Output:

IRONSUPPLYSALES
PO67633 8894PO00902 545
PO112118PO67633 889
PO00902 5451PO22123 221



Thanks in advance

 

4 REPLIES 4
ThePickleWizard
7 - Meteor

Here is my string so far:

 

If findString([Sales], [Iron])>=0
THEN
[Sales]
else
""
endif

 

My string creates additional rows under the Iron Column with a blank row for Supply and 

IRONSUPPLYSALES
 4PO65841
PO112118PO57756
 1PO22123 221

PO67633 889
 PO67633 889

PO00902 545
 PO00902 545
DavidSkaife
13 - Pulsar

Hi @ThePickleWizard 

 

In order to effectively do this a standard Formula tool won't suffice, instead you'll need to use aMulti-Row Formula tool. Below (and attached) is one way of doing this:

 

DavidSkaife_0-1677967083477.png

 

First place a RecordID tool to allow you to keep the order of the data, then Transpose it vertically. Sort the data on Value so it places the figures in Iron/Sales next to each other, then apply your formula like so:

 

DavidSkaife_1-1677967198195.png

 

 

Cross tab the data back to the horizontal, sort again but this time on RecordID, and finally move the fields around to the original layour/remove the RecordID:

DavidSkaife_2-1677967247950.png

 

 

 

binuacs
21 - Polaris

@ThePickleWizard One way of doing this

binuacs_0-1677967516423.png

 

ThePickleWizard
7 - Meteor

Awesome stuff. It's unfortunate that I cannot use the If findstring method. I will give both methods a try. Thanks for the responses and time!

Labels