Convert string with commas and decimals to number
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi - what is the best way to convert these from string to numbers. I have tried and it keeps returning just the numbers before the comma. I can't remove all punctuation because I also want to keep the decimal place. thanks!
4,006,213,560.39
19,905 386,716.32
108,471
2,108,988.82
72,053,698.07
1,453,328.96
2,364,943.17
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks, that worked. I also have numbers that are like this:
874.19-
How would I make that into a negative number? I am thinking an if formula, but not sure how to tell Alteryx to add - to the beginning of the number and remove it from the end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Good and easy solution. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is there any way to use this in a data cleansing tool? In my case there are about 200 numbers coming in from Excel with commas and decimals being interpreted as strings. Doing a replace 200 times and creating a manual cleansed version of every field is going to be incredibly tedious. I see that you can remove punctuation but that seems to remove the decimal with the comma. The problem is that when I convert these to Float with the Select tool, it stops reading after the comma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
A Multi-Field Formula would be your next step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
A very simple way to do this is to place a formula tool and write the function tonumber([column_name]) and then place a select tool immediately after and select one of the numeric data types like double or fixed decimal for that column.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
for me it helped to pay attention to the column that I was trying to perform a calculation against. I kept focusing on the column that I had already changed thinking that it was still the issue cause I was still getting an error. Pay attention to both columns metadata and be sure to change your column data type in the formula tool too 🙄
