Hi All,
I am trying to perform a condition where if the column contains % then i want to pick up the XX.X% or if the column contains a specific phrase then pick up 4-5 characters before that phrase in that column and put it in a new column.
Is there a way to get that done? Any ideas will be great!
Thanks in advance!!
Solved! Go to Solution.
Hi @SArielle!
Will something like this work?
If not, will you please send over some dummy data and the desired output?
Thanks,
Deb
Let me try your suggestion out but let me also share some dummy data that is similar to what I have.
This is the data
| Customer | Desc 1 | Desc 2 | Comment 1 | Comment 2 |
| A | Discount given is 10% | Approval pending | Last purchase 30% discount given | |
| B | Approval given by Director | Discount given is 25% | First discount | |
| C | Quoted 15% above base price | Customer requested loyalty discount | Discount given is 5.5% | Approval given by Director |
and the desired output would be having an additional column that captures the discount
| Customer | Discount |
| A | 10% |
| B | 25% |
| C | 5.5% |
Thanks Sapna, just a quick question if my numerics is not a % instead it is a $ in front of the numeric or if it is a specific phrase after the numerics how can i amend the regex format to achieve the same results you have?
@SArielle , I used the below regex. As $ is represented as the end of the line in Alteryx so I skipped this character and used a formula tool to replace the $ with ""
(\d.+%|\$\d.+)
Attached is the updated workflow.
Thanks!
Hi @SArielle!
Did @grazitti_sapna's solution work for you? If so, kindly select it as the solution. Marking a solution helps other users facing similar issues.
Thank you everyone!!! Really appreciate all the support on this!
@grazitti_sapna your solution was really great, it helped me to parsed out a lot of the data but still some minor errors.
I also have an additional question, might be quite basic but does all the output from Regex auto becomes string despite choosing in the output columns as a double?
@SArielle, as you are parsing the data in form like 10%, 35% so this can only result in string data type in case you just parse the digits then you can select the double data type.
Thanks!
