Help

I need a formula for 2 decimal digits mixed with text

Topic Labels: Formulas
Solved
Jump to Solution
646 13
cancel
Showing results for 
Search instead for 
Did you mean: 
LemonSorbet
4 - Data Explorer
4 - Data Explorer

I'm new here so I do not know that many formula. I imported my tables from excel and I have it generate name of the product with product name + weight. However, I want the numbers that are generated in 2 digits format. And here is my current formula :

"[90.0]"&" "&{product name}&" "&{weight)}
I tried using Round(), but it didn't help.  Screenshot 2024-04-25 103621.png
1 Solution

Accepted Solutions

I tried to use your values and have the same mistake. I suppose it's because 2.30 stored in dataset as smth like 2.29999999999997. a few minutes and I'll find the solution  

UPDATE: it works, when using ROUND instead of INT

{productname}&" "&ROUND(weight)&"."&RIGHT(''&ROUND(weight*100),2)

See Solution in Thread

13 Replies 13
LemonSorbet
4 - Data Explorer
4 - Data Explorer
CONCATENATE("[90.0] ",{productname}," ",ROUND({weight},2))
 
This formula does not work either

Hi,
Please type desired output.
If 2-digit means numbers like 2.1, 1.9 , the number of digits can be set in field settings.

If I understand correctly this should work

{productname}&" "&INT(weight)&"."&RIGHT(""&(weight*100),2)

I did work for some of it but I don't understand why some of them aren't correctScreenshot 2024-04-26 123434.pngScreenshot 2024-04-26 123349.png

Because some weight values having more digits, despite displaying just two after point, and RIGHT takes last two of them. You can see it by adding more digits in field settings.
Sorry, i didn't understand at first what's wrong with result. In you case, I would insert the dot on a right place

REPLACE(productname&' '&INT(weight*100),
LEN(productname&' '&INT(weight*100))-1,0,'.')



some of it seems correct but still I have problems with the weight 2.30 that is now shown as 2.29 and 1.15 is now shown as 1.14. I don't understand why it did not directly use the number in the weight field

Screenshot 2024-04-26 133430.png

I copied your formula and pasted it, but parts of it still gave incorrect results

Or even a bit easier, just apply INT to a second weight value to cut all extra digits after these two 

{productname}&" "&INT(weight)&"."&RIGHT(''&INT(weight*100),2)

I tried to use your values and have the same mistake. I suppose it's because 2.30 stored in dataset as smth like 2.29999999999997. a few minutes and I'll find the solution  

UPDATE: it works, when using ROUND instead of INT

{productname}&" "&ROUND(weight)&"."&RIGHT(''&ROUND(weight*100),2)