< Back
Expand-NumberFormat
Post
NAME Expand-NumberFormat
SYNOPSIS
Converts short names for number formats to the formatting strings used in Excel
SYNTAX
Expand-NumberFormat [[-NumberFormat] <Object>] [<CommonParameters>]
DESCRIPTION
Where you can type a number format you can write, for example, 'Short-Date' and the module will translate it into
the format string used by Excel. Some formats, like Short-Date, change when Excel loads (so date will use the
local ordering of year, month and Day). Excel also changes how markers in the are presented different cultures ","
is used in the format string to mean "local thousand seperator" but depending on the country "," or "." or " " may
used as the thousand seperator.
PARAMETERS
-NumberFormat <Object>
The format string to Expand
Required? false
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.String
NOTES
-------------------------- EXAMPLE 1 --------------------------
Expand-NumberFormat percentage
Returns "0.00%"
-------------------------- EXAMPLE 2 --------------------------
Expand-NumberFormat Currency
Returns the currency format specified in the local regional settings, which may not be the same as Excel uses.
The regional settings set the currency symbol and then whether it is before or after the number and separated with
a space or not; for negative numbers the number may be wrapped in parentheses or a - sign might appear before or
after the number and symbol.
So this returns $#,##0.00;($#,##0.00) for English US, #,##0.00 ???????;???????#,##0.00- for French.
Note some Eurozone countries write ???????1,23 and others 1,23???????. In French the decimal point will be rendered as a ","
and the thousand separator as a space.
RELATED LINKS
SYNOPSIS
Converts short names for number formats to the formatting strings used in Excel
SYNTAX
Expand-NumberFormat [[-NumberFormat] <Object>] [<CommonParameters>]
DESCRIPTION
Where you can type a number format you can write, for example, 'Short-Date' and the module will translate it into
the format string used by Excel. Some formats, like Short-Date, change when Excel loads (so date will use the
local ordering of year, month and Day). Excel also changes how markers in the are presented different cultures ","
is used in the format string to mean "local thousand seperator" but depending on the country "," or "." or " " may
used as the thousand seperator.
PARAMETERS
-NumberFormat <Object>
The format string to Expand
Required? false
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.String
NOTES
-------------------------- EXAMPLE 1 --------------------------
Expand-NumberFormat percentage
Returns "0.00%"
-------------------------- EXAMPLE 2 --------------------------
Expand-NumberFormat Currency
Returns the currency format specified in the local regional settings, which may not be the same as Excel uses.
The regional settings set the currency symbol and then whether it is before or after the number and separated with
a space or not; for negative numbers the number may be wrapped in parentheses or a - sign might appear before or
after the number and symbol.
So this returns $#,##0.00;($#,##0.00) for English US, #,##0.00 ???????;???????#,##0.00- for French.
Note some Eurozone countries write ???????1,23 and others 1,23???????. In French the decimal point will be rendered as a ","
and the thousand separator as a space.
RELATED LINKS