Round numbers in a formular with 3 decimals do not round properly

#1

I got a field that summarises some numbers with some text.
One of the numbers needs to be rounded to a with 3 decimals so I wrap the number in ROUND(), but it only gives me a precission of 1.

'Total weight: ’ & ROUND({Total Weight},3) & ‘kg’
Gives me:
‘Total weight: 0.8kg’

But looking to get:
‘Total weight: 0.800kg’

What an I not getting?

#2

Check the formatting for your formula field. Decimal values default to only showing one place past the decimal point. You need to manually change the format to show more precision.

#3

Actually, in this case it’s not the formatting: It’s that Airtable doesn’t retain significant digits when converting from a number to a text string. You can use the code from my pretty-print routines — or I think this will do what you want:


'Total weight: '&

ROUND(
	{Total Weight},
	3
	)&

REPT(
	'0',
	3-(
		LEN(
			ROUND(
				{Total Weight},
				3
				)&''
			)-FIND(
				'.',
				ROUND(
					{Total Weight},
					3
					)&''
				)
		)
	)&
	
' kg'

Edit: I chickened out and tested it, and it does do what you want. :wink:

3 Likes
#4

Thank you much appreciated, taking your time.