Decimal Puzzle

SAB3012
SAB3012 ✭✭
edited 12/09/19 in Smartsheet Basics

This one might be fun.

I have a number....let's say   32.1204

But what I really want is to have it be 32.12040  because I want to turn it into a string and peel off the right two numbers.

I've tried ROUND(number,5) but that doesn't work.

I can hit the increase decimal button and make it show as 32.12040, but then if I try to turn it into a string with =""+number, that right most "0" goes away and I'm back to 32.1204

So with my limited knowledge of Smartsheet functions, I came up with this.....using LEN and FIND.

=IF(LEN("" + SUM(CHILDREN())) - FIND(".", "" + SUM(CHILDREN())) = 4, "" + (SUM(CHILDREN()) + "0"), "" + SUMIF(CHILDREN()))

-------------------------------------

So the ""+SUM(CHILDREN()))  adds up all the children cell values and the ""+ turns it into a string.

I then look at the length of the string and subtract the location of the FIND decimal point.  So the string length is 7 and the decimal point is at location 3 gives me the value of 4.

So then IF the value is 4, then again, convert the value to a string and concatenate a "0" on the end to make it "32.12040"

Can somebody come up with a simpler way?

Note:  Interesting that in the "true" case, without the parens around SUM(CHILDREN())+"0" I get an invalid operation error.

Comments