Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Jun 29, 2017 06:26 AM
I have a Formula field that gives me a number. How can I convert it to a String text? I have viewed the entire reference article but I don’t find it.
Thanks!
Jul 30, 2017 04:46 PM
I realize you’ve already figured this out, but as a breadcrumb for future searchers, to convert a numeric value to a string, simply concatenate it with the empty string (""):
CONCATENATE({NumericValue},"")
or
{NumericValue} & ""
Aug 01, 2017 03:31 AM
I didn’t remember how I solved this nor in what base I needed :grinning_face_with_sweat: Anyway thanks for the tip! :raised_hands:
Jan 10, 2018 07:33 AM
Is there a way to preserve the currency formatting when converting a number to a string? For example, I’d like to keep the dollar sign and the comma when converting the dollar amount $10,000 to text.
Existing Number/Currency Field
$10,000
Desired Result/Text Field
"You won $10,000!"
Thank you!
Jan 10, 2018 08:03 AM
Say field with the amount is called “Money”, the formula may be:
CONCATENATE(“You won $”,{Money},"!")
Jan 10, 2018 12:16 PM
Hi Andre,
Thanks for your quick reply! This works - but I lose the comma in the 10,000. The result is this:
“You Won $10000!”
Any idea how to preserve the comma?
Thanks Again!
Jan 10, 2018 12:37 PM
As I recall, I was never able to preserve the comma but had to manually parse and reformat the output. I just spent a half-hour looking for my base with the code to do that – and I’m stumped. If I manage to dig it up, I’ll post it…
Jan 10, 2018 01:15 PM
You can use this:
CONCATENATE(“You won $”,LEFT(MoneyTxt,2),",",RIGHT(MoneyTxt,3),"!")
First I created a field “MoneyTxt”, where the amount “10000” was created.
Of course the formula should go a little deeper thinking of every instance where the amount may be 7 figures or 3, 4 and so on. But this works with 5 figures.
Mar 22, 2018 04:36 AM
If your numbers can be of various lengths you can do if statements, and the formula can get very long, I did it for up to 7 figures:
(IF(LEN(CONCATENATE({Final Sales},""))=4,(LEFT(CONCATENATE({Final Sales},""),1) & "." & RIGHT(CONCATENATE({Final Sales},""),3)),IF(LEN(CONCATENATE({Final Sales},""))=5,(LEFT(CONCATENATE({Final Sales},""),2) & "." & RIGHT(CONCATENATE({Final Sales},""),3)),IF(LEN(CONCATENATE({Final Sales},""))=6,(LEFT(CONCATENATE({Final Sales},""),3) & "." & RIGHT(CONCATENATE({Final Sales},""),3)),IF(LEN(CONCATENATE({Final Sales},""))=7,(LEFT(CONCATENATE({Final Sales},""),1) & "." & MID(CONCATENATE({Final Sales},""),4,3) & "." & RIGHT(CONCATENATE({Final Sales},""),3)),{Final Sales})))))
Mar 24, 2018 07:01 PM
See my recent post in ‘Show and Tell’ for some [reasonably, I think] robust routines for ‘pretty-printing’ numbers and currency into user-friendly strings.