Alteryx Designer Desktop Discussions

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

Extract one number from large text column

moemoney
5 - Atom

I have a column that have text and number. there multiple sets of number, I would like to get on set that is preceded by $,

Example:

 

JED/in amount of $12.20 charged to the account 769990000.

 

I only would like to extract the "12.20".

could you please help me?

 

9 REPLIES 9
kat
12 - Quasar

Hi @moemoney

 

This will require some regex to pull out the numbers. There are many ways to do this - I've attached an example.

 

Hope this works for you!

Kat

ponraj
13 - Pulsar

Here is the sample workflow for your case. Hope this is helpful. 

 

WorkflowWorkflow

MarqueeCrew
20 - Arcturus
20 - Arcturus
In a formula tool:

Regex_replace([field],".*\$(\d+\.?\d{0,2})\s.*",'$1')

Will get you the amount.

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
moemoney
5 - Atom

Thank you Mark,

 

it worked on most of the row, except on the ones with the thousand separator ",".

danrh
13 - Pulsar

Minor change to @MarqueeCrew's solution to allow thousand separators:

 

Regex_replace([field],".*\$([\d,]+\.?\d{0,2})\s.*",'$1')
MarqueeCrew
20 - Arcturus
20 - Arcturus

@danrh,

 

Thanks for the regex update.  Here's another view:

 

 

 
Regex_replace([field],".*\$([\d\,\.]+)\s.*",'$1')

Cheers,

Mark

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
moemoney
5 - Atom

when there is period at the end, it doesn't quite get the proper value, is there a way to ignore anything after the two decimal points. Please the original text on the right under comment:

Reject_AmountComment
7,166.00%% ACH ECC PPD\nIn the amount $7,166.00 IRS\n
279.61%% ACH ECC PPD\nIn the amount $279.61 COMCAST MARYLAND\n
106.10%% ACH ECC WEB\nIn the amount $106.10 WASHINGTON GAS\n
In the amount $140.00.\nIn the amount $140.00.\n
100.00%% ACH ECC WEB\nIn the amount $100.00 PAYPAL\n
373.98%% ACH ECC WEB\nIn the amount $373.98 VERIZON\n
In the amount $3,818.53.\nIn the amount $3,818.53.\n
205.70%% ACH ECC PPD\nIn the amount $205.70 GEICO\n
643.48%% ACH ECC PPD\nIn the amount $643.48 WELLS FARGO BANK\n
58.78%% ACH ECC PPD\nIn the amount $58.78 FGLIFEINSCO\n
In the amount $123.14.\nIn the amount $123.14.\n
MarqueeCrew
20 - Arcturus
20 - Arcturus

@moemoney,

 

Regex_replace([field],".*\$([\d,]+\.?\d{0,2})[\s\.].*",'$1')

modified search for a space to include another decimal.

 

 

 

Cheers,

 

Mark

 

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
moemoney
5 - Atom

thank you Mark!!!! 

this worked perfectly!!

 

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels