Skip to Content

SKEWNESS

Overview

The SKEWNESS function calculates the skewness of a dataset. Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. The skewness value can be positive, negative, or undefined.

  • Positive skewness (right-skewed): The tail on the right side of the distribution is longer or fatter than the left side. The mean and median will be greater than the mode.
  • Negative skewness (left-skewed): The tail on the left side of the distribution is longer or fatter than the right side. The mean and median will be less than the mode.
  • Zero skewness: The distribution is perfectly symmetrical.

For more details, see the SciPy documentation for scipy.stats.skew.

This example function is provided as-is without any representation of accuracy.

Usage

To use the function in Excel:

=SKEWNESS(data, [bias])
  • data (2D list, required): The input dataset. Can be a 2D list representing a column or row vector.
  • bias (bool, optional, default=True): If False, the calculations are corrected for statistical bias.

The function returns a single value (float): the skewness of the dataset, or an error message (string) if the input is invalid.

Examples

Example 1: Positively Skewed Data

This example calculates the skewness of a dataset that is positively skewed.

Inputs:

databias
1True
2
3
4
10

Excel formula:

=SKEWNESS({1;2;3;4;10}, TRUE)

Expected output:

Result
1.41

This indicates a positive skewness, meaning the tail of the distribution is longer on the right side.

Example 2: Negatively Skewed Data

This example calculates the skewness of a dataset that is negatively skewed.

Inputs:

databias
1True
7
8
9
10

Excel formula:

=SKEWNESS({1;7;8;9;10}, TRUE)

Expected output:

Result
-1.14

This indicates a negative skewness, meaning the tail of the distribution is longer on the left side.

Example 3: Symmetrical Data (Bias=True)

This example calculates the skewness of a symmetrical dataset with bias correction enabled.

Inputs:

databias
1True
2
3
4
5

Excel formula:

=SKEWNESS({1;2;3;4;5}, TRUE)

Expected output:

Result
0.0

This indicates a symmetrical distribution.

Example 4: Symmetrical Data (Bias=False)

This example calculates the skewness of a symmetrical dataset with bias correction disabled.

Inputs:

databias
1False
2
3
4
5

Excel formula:

=SKEWNESS({1;2;3;4;5}, FALSE)

Expected output:

Result
0.0

This also indicates a symmetrical distribution, as expected for symmetrical data regardless of bias correction.

Python Code

import micropip await micropip.install('scipy') from scipy.stats import skew as scipy_skew import numpy as np def skewness(data, bias=True): """ Calculate the skewness of a dataset. Args: data: The input dataset (2D list). bias: If False, the calculations are corrected for statistical bias (bool). Returns: The skewness of the dataset (float), or an error message (str) if input is invalid. This example function is provided as-is without any representation of accuracy. """ if not isinstance(data, list) or not data: return "Invalid input: data must be a non-empty 2D list." # Flatten the 2D list to a 1D list flat_data = [] for row in data: if not isinstance(row, list): return "Invalid input: data must be a 2D list." for item in row: try: flat_data.append(float(item)) except (ValueError, TypeError): return "Invalid input: data must contain numeric values." if len(flat_data) < 3 and not bias: return "Invalid input: At least 3 data points are required for unbiased skewness calculation." if len(flat_data) < 2: return "Invalid input: At least 2 data points are required for skewness calculation." try: result = scipy_skew(flat_data, bias=bias) except Exception as e: return f"scipy.stats.skew error: {e}" return round(float(result), 2)

Live Notebook

Edit this function in a live notebook.

Live Demo

Last updated on