STATS_CRAMER – Cramer's V for categorical association

What it does

Cramer's V effect size for association between two categorical columns.

Uses the chi-square statistic from the observed contingency table without bias correction.

Syntax

=STATS_CRAMER(columns, rowCol, colCol)

Parameters

columns — required

Cell range with data, e.g., A1:D100 or A:D.

Usually the first row should contain column names.

You can also add labels as the first row and column names as the second row.

Labels should use formats like "male:1,female:2" or "low:1:3,mid:3:5,high:5:7".

Examples:

  • A1:D100 — use 4 columns
  • A1:C200 — use 3 columns
  • A:F — use 6 columns
  • A1:D100 where row 1 contains labels and row 2 contains column names — use labels from the sheet

If every non-empty cell of the first row holds at least two label rules ("low:1,high:2"), it is the labels row, and the next row holds the column names; an empty cell there is a column without labels.

One rule in a cell ("yes:1") is read as a name, so a header such as "T:1", "Ratio 1:2" or "Note:" stays the names row. Give such a column a second rule, or pass one label in the labels parameter, where one rule is valid.

If the first row contains ordinary text, it is treated as the column names row as before.

A number, a date or a checkbox in the names row is a name: 2025, 2025-01-01, TRUE.

Column names must be unique: two identical headers are an error "Duplicate column name: x".

Every column with values needs a name: an empty header cell over values is an error "The name of column 2 is empty: a column with values needs a name", even when colFilter does not select that column. A column with neither a name nor values (the empty right edge of a range such as A:Z) is dropped without an error.

Column names that start with "#" are reserved/unsupported in filters, because "#" is used for index-based colFilter rules (for example #1, #2-#5).

What counts as a number (the same in every function):

  • A column is numeric when it holds more numbers than text; with as many texts as numbers, or more, it is a text column.
  • Every cell is typed by itself: a number written as text ('10', '007') is the number, a checkbox is 1 (checked) or 0 (unchecked). The texts 'TRUE'/'FALSE' stay text.
  • A cell that does not match the type of its own column (text in a numeric column, a number in a text column) is missing for calculations and is counted in missing.
  • An empty cell is a missing answer; the sign "." means "not applicable" — it is not a missing answer, not a category and not counted in missing.
  • A text column with value labels (a labels row above the names) is analysed by the codes of its labels. A text column without labels is not analysed as numbers: lists of columns skip it with a note, tests on a pair of columns and models show an error.

An empty tail of the range (rows below the data) is dropped — only blank cells make it: a row of "." at the end stays and counts as not applicable, as in the middle. A column with neither a name nor values is dropped; a named empty column stays.

rowCol — required

Name of the categorical column used for table rows.

Examples:

  • gender
  • group
  • mood
colCol — required

Name of the categorical column used for table columns.

Examples:

  • group
  • gender
  • mood

Examples

  • — the sample data (50 rows) all examples use
  • — =STATS_CRAMER(Data!A1:T51, "gender", "group")

What the result contains

Returns V, chi2, df, p, N, row count, column count, and warnings when relevant.

How to read the result

V is the strength of the relation, from 0 to 1: about 0.1 small, 0.3 medium, 0.5 large (for tables with two rows or columns; lower with more categories).

p is the chi-square test: below 0.05 — the relation is unlikely to be chance. Check Warnings for small expected counts.

In a report: "The relation was weak and not significant, V = .08, χ²(2, N = 50) = 0.31, p = .859."

What each number means

V — Cramér's V

A common guide (Cohen) for a 2 × k table: 0.1 small, 0.3 medium, 0.5 large; with more categories on both sides the thresholds are lower.

In a report: V = .08, χ²(2, N = 50) = 0.31, p = .859.

chi2 — Pearson chi-square

The larger, the stronger the evidence of a relation; read p. In a report: χ²(2, N = 50) = 0.31, p = .859.

df — Degrees of freedom of the chi-square

Written in brackets: χ²(2, N = 50) = 0.31.

p — p of the chi-square

Below 0.05 — the two variables are related: the answers to one depend on the answer to the other. It does not say how strongly — Cramér's V does. With warnings below, treat p with care.

N — N

Report it with the test: χ²(2, N = 50) = 0.31.

Rows — Rows

The size of the table as shown. The chi-square counts only categories that have rows: df = (Rows − 1)(Columns − 1) over those.

Columns — Columns

The size of the table as shown. The chi-square counts only categories that have rows: df = (Rows − 1)(Columns − 1) over those.

How it is computed

The chi-square test of the two columns, as STATS_CHI2; V = √(χ² / (N · min(Rows − 1, Columns − 1))), over the non-empty categories.

Errors

Unknown columns or degenerate categories return a one-cell message or warnings.

Rows with missing values in either selected column are excluded pairwise.

About STATS_CRAMER

STATS_CRAMER calculates Cramer's V, an effect size for the association between two categorical columns: it shows how strong the association is, not only whether it exists. Name the column for the table rows (rowCol) and the column for the table columns (colCol), for example gender and group. The report recalculates by itself when new responses arrive from Google Forms.

V is computed from Pearson's chi-square of the observed contingency table, as in STATS_CHI2, without bias correction: V = √(χ² / (N · min(Rows − 1, Columns − 1))), over the non-empty categories. The report gives V together with chi2, df, p, N, the numbers of rows and columns, and warnings when relevant.

Rows with a missing value in either column are left out. Coded answers can carry value labels in a labels row above the column names, such as male:1,female:2. If a column is unknown or the categories are degenerate, the function returns a one-cell message or warnings instead of a result. Every number of the report is explained on this page in plain words.