Format a decimal using at least 2 places and at most 6 places

Viewed 2678

To meet a specification I need to format a decimal value with the rule:

  • All values must have at least two decimal places and at most six.

Example:

Value        Formatted
1            1.00
1.1          1.10
1.1234       1.1234
1.123456     1.123456
1.12345678   1.123456

I guess I'll end using a condition, but I wonder if there is a format string which can do this.

1 Answers
Related