Int16.From

The function Int16.From returns a 16-bit integer number value based on the input value provided. If the input value is null, the function returns null. If the input value is a number within the range ...

Syntax

Int16.From(value as any, optional culture as nullable text, optional roundingMode as nullable number) as nullable number

About

The function Int16.From returns a 16-bit integer number value based on the input value provided. If the input value is null, the function returns null. If the input value is a number within the range of a 16-bit integer without any decimal points, the value is returned as is. However, if the input value contains decimal points, it will be rounded based on the specified rounding mode. By default, the rounding mode is set to RoundingMode.ToEven. If the input value is of a different data type, it will be first converted to a number using the Number.FromText function. For information on available rounding modes, please refer to the Number.Round function. Additionally, an optional culture parameter can be included, for example, "en-US".

Explanation

Obtain the 16-bit integer value for the number "4". Usage: Use Power Query function MInt16.From("4"). Output: 4 Obtain the 16-bit integer value for the number "4.5" using the RoundingMode.AwayFromZero. Usage: Utilize Power Query function MInt16.From("4.5", null, RoundingMode.AwayFromZero). Output: 5