Replicate Excels 'Comma Style' formatting of numbers
- 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
Good day, I am trying to replicate Excels number formatting 'Comma Style' in Alteryx when outputting reports, i.e. format with a thousands separator (a space not a comma). Also, zero should appear as a dash, i.e. - instead of 0.
Any suggestions would be appreciated?
Solved! Go to Solution.
- Labels:
- Output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Alastair
Using the optional parameters in the ToString function may help you.
Like:
ToString([number], 2, 1)
For thge Zero, a simple formula will do:
IF [number]=0
THEN "-"
ELSE [number]
ENDIF
Hope this helps
Best,
_AG_
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Aguisande thanks for the response! Much appreciated.
The simple formula for replacing the zero works perfectly.
For the number formatting I used the following formula:
ToString([Number], 0,1)
It appears that when the number is longer than 6 characters, I get a conversion error: Number was truncated, i.e. 1,373,235 which outputs to 1,373,23. Any idea how to fix this?
Oh and one more thing, if don't want the commas as separators but rather spaces, how would you go about that, i.e. 1 373 235 as an ouput.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Maybe using the ReplaceChar function ( ReplaceChar(String, character to replace, character to replace with)) may help you. In this case it'll be ReplaceChar(String, ","," ")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Aguisande ok great. I will try that.
Any idea about the conversion errors, i.e. the truncating of long numbers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Please, check the length of the String being generated in the formula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Aguisande brilliant! I changes the size from the the default 8 to 12 and no further conversion errors.
The replace formula also worked. Thanks again.
