Home : NFORMATZ
Q14325 - INFO: NFORMATZ
 NFORMATZ formats/rounds a number (with or without a symbol) and returns the formatted value as a string.

SYNTAX:

NFORMATZ(Value, Format, NoValuePrint)

Value: Value to be formatted.  Can be a numeric value, quoted string, cell reference or another function.  Value must be able to be evaluated as a number (i.e. a number or a value prefixed with a valid symbol (<2, >4)

Format:  A valid microsoft format string.  See tables below for explanation of Format.

NoValuePrint: What to return when there is a no value (ie blank cell). 

FORMAT:

The Format is a string of characters that sets how the value will be formatted.

Format Character Description                                                                  
0 (Digit placeholder) Display a digit or a zero. If the expression has a digit in the position where the 0 appears in the format string, display it; otherwise, display a zero in that position. If the number has fewer digits than there are zeros (on either side of the decimal) in the format expression, display leading or trailing zeros. If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, round the number to as many decimal places as there are zeros. If the number has more digits to the left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, display the extra digits without modification.
# (Digit placeholder) Display a digit or nothing. If the expression has a digit in the position where the # appears in the format string, display it; otherwise, display nothing in that position. This symbol works like the 0 digit placeholder, except that leading and trailing zeros aren't displayed if the number has the same or fewer digits than there are # characters on either side of the decimal separator in the format expression.
. (Decimal placeholder)

In some locales, a comma is used as the decimal separator. The decimal placeholder determines how many digits are displayed to the left and right of the decimal separator. If the format expression contains only number signs to the left of this symbol, numbers smaller than 1 begin with a decimal separator. If you always want a leading zero displayed with fractional numbers, use 0 as the first digit placeholder to the left of the decimal separator instead. The actual character used as a decimal placeholder in the formatted output depends on the Number Format recognized by your system.

 

% Percent placeholder

The expression is multiplied by 100. The percent character (%) is inserted in the position where it appears in the format string.

 

, (Thousand separator)

In some locales, a period is used as a thousand separator. The thousand separator separates thousands from hundreds within a number that has four or more places to the left of the decimal separator. Standard use of the thousand separator is specified if the format contains a thousand separator surrounded by digit placeholders (0 or #). Two adjacent thousand separators or a thousand separator immediately to the left of the decimal separator (whether or not a decimal is specified) means "scale the number by dividing it by 1000, rounding as needed." You can scale large numbers using this technique. For example, you can use the format string "##0,," to represent 100 million as 100. Numbers smaller than 1 million are displayed as 0. Two adjacent thousand separators in any position other than immediately to the left of the decimal separator are treated simply as specifying the use of a thousand separator. The actual character used as the thousand separator in the formatted output depends on the Number Format recognized by your system.

 

- + $ ( ) space

Displays the character as is, in the position specified by the format string. To display a character other than one of those listed, precede it with a backslash (\).

 

E- E+ e- e+ Scientific format

Displays the character as is, in the position specified by the format string. To display a character other than one of those listed, precede it with a backslash (\).

 

The format can have up to three sections that specify how to handle different numbers (positive, negative, and zero).  The sections are divided by semi-colon (;)

If you use The Result is
One section The format expression applies to all values.
Two sections The first section applies to positive values and zeros, the second to negative values.
Three sections The first section applies to positive values, the second to negative values, and the third to zeros.

 

EXAMPLES:

NFORMATZ(4.00,"#,##0.000","") returns 4.000.

NFORMATZ(B7,"#,##0.0;(#,##0.0);\N\a\d\a","NO VALUE"):
    If B7 is positive, format number using #,##0.0.  Ie 4,321.0
    If B7 is negative, format number using (#,##0.0).  ie -6532.78 returns (6532.8)
    If B7 is zero (0), return the word Nada
    If B7 is a blank cell, return NO VALUE.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 5/20/2015 5:05 PM.
Last Modified on 5/20/2015 5:08 PM.
Last Modified by Scott Dorner.
Article has been viewed 2053 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article