STATS_FREQUENCIES – frequencies report for chosen columns
What it does
Calculates frequencies for chosen columns.
Returns one combined report table in long format for easier reading and export.
If labels are provided, values are grouped by these labels (exact values or ranges), in the order of the labels; a value outside them is counted in "_other". Labels given here win over the labels of the column.
If labels are not provided, the labels of the column are used (a labels row above the names); without them, groups follow SPSS: numbers ascending, text alphabetically.
Percentage is calculated from the rows of the selected scope; Valid Percentage only from valid rows.
Service rows: "missing" counts empty answers (no Valid Percentage); "not applicable" counts the sign "." and is left out of both percentages.
An answer that is literally "missing" or "not applicable" is an ordinary group of its own. On a text column with labels, "_other" has no Valid Percentage.
Syntax
=STATS_FREQUENCIES(columns, colFilter, labels)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 columnsA1:C200— use 3 columnsA:F— use 6 columnsA1: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.
colFilter — optional, default "*"
Comma-separated column selector.
Use names ("age,score"), negative rules ("-id,-note"), a regex ("/^q/"), or index rules ("#N", "#A-#B", "-#N", "-#A-#B").
Case-sensitive; flags are not supported.
A name that does not exist is an error: "Column nope does not exist" (excluding it, "-nope", is ignored). Empty — all columns ("*").
Examples:
"age,score"— Names only (include only "age" and "score")"-id,-group"— Exclude some (include all except "id" and "group")"/^q/"— Regex only (all starts with "q")"#1,#3-#5"— Index include rules (first, and range 3..5)"-#1,-#3-#4"— Index exclude rules (drop first and 3..4)"age,#2-#4,-#3"— Mixed name/index rules with deterministic order"age,/^q/,-q5"— Mixed (include age, all starts with "q" except "q5")"/^x1{1,2}$/"— Regex with a comma inside: x1 and x11
Choose which columns from columns to use - a comma-separated string of rules.
⚙️ Four rule types (you can mix them):
- By name - exact header text (case-sensitive)
- "age,score,total"
- Negative rules - exclude by name (prefix with
-)- "-id,-notes" (include all except
idandnotes)
- "-id,-notes" (include all except
- Regex - a regular expression between slashes
/.../- "/^q/" (all headers starting with
q), "/(score|age)/", "/^x1{1,2}$/" (commas inside /.../ do not split the filter) - ❗— case-sensitive
- ❗— flags are not supported.
- "/^q/" (all headers starting with
- Index rules - position-based rules with
#- "#1" (first selected column), "#2-#5" (range), "-#1", "-#2-#4"
"*" alone selects every column; it cannot be combined with other rules ("*,-id" is an error) — write "-id" instead.
Rules are applied in the written order, and the selected columns keep that order ("/^q/,-q5,age" puts age last).
Index rules count the columns of the range: "#1" is its first column.
A name that does not exist is an error: "Column nope does not exist" — also in colName, yName, steps, rowCol, colCol and colNameForSplit. Excluding a name that does not exist ("-nope") is ignored.
A filter that selects no column — a regex without a match ("/^Q/" where the columns are q1, q2), index rules past the end, exclusions that remove every column — is an error that names the filter and the columns of the range: colFilter "/^Q/" selects no columns (columns: q1, q2, t). Empty and "*" select every column.
In STATS_ANALYZE, a regex with brackets or | needs the new syntax: PEARSON('/(score|age)/').
A colFilter saved in Settings applies to every formula without its own filter: on a range without those columns the formula shows the error above.
# prefix is reserved for index syntax and is not treated as a column-name filter token.
colFilter applies to all expressions in query. It does not create separate groups per expression.
labels — optional
Groups for the values of a column: "label:value,label:value" for exact values, "label:min:max" for ranges.
A range is [min, max): min included, max not; an empty bound is open on its side ("high:3:" — 3 and above, "low::0" — every value below 0).
Spaces around the colon are not part of the label: "Never : 1" names Never, here and in a labels row above the names.
On a text column the value is the text of the cell ("male:m,female:f").
Examples:
"male:m,female:f"— text answers m and f named male and female"low:1:3,high:3:"— ranges: 1 ≤ x < 3 is low, 3 and above is high"good:1:3,normal:3:6,bad:6:11"— three ranges"low::0,high:0:"— open bounds: negative values are low, 0 and above is high
Labels given here win over the labels of the column (a labels row above the names). Empty — the labels of the column, if it has them.
Groups are listed in the order of the labels. A value outside the labels goes to the group "_other", listed last.
STATS_FREQUENCIES shows the first part as the group name: write "label:value".
STATS_SPLIT_COLS takes both orders, "1:male" and "male:1", and names the columns {column}-{label}.
Without labels, groups follow SPSS: numbers ascending, text alphabetically. A text scale with a natural order (education levels, Likert words) needs labels to keep that order.
Examples
- — the sample data (50 rows) all examples use
- — ranges: [1,3), [3,6), [6,11)
=STATS_FREQUENCIES(Data!A1:T51, "/q/", "good:1:3,normal:3:6,bad:6:11") - — exact values with names
=STATS_FREQUENCIES(Data!A1:T51, "gender", "male:1,female:2") - — Use labels already stored in the source column
=STATS_FREQUENCIES(Data!A1:T51, "gender")
What the result contains
Returns a single report table with columns: Variable, Group, Amount, Percentage, Valid Percentage.
Each analyzed variable is listed in separate grouped rows inside the same table.
How to read the result
Check missing first: many empty answers make the percentages less representative.
Describe the answers by Valid Percentage — the share among those who answered.
A large _other means a label is missing or misspelled.
In a report: "40% of respondents rated the service as bad, 38% as normal and 22% as good (n = 50)."
What each number means
Variable— VariableRead the numbers along this row or column for that variable.
Group— GroupRead the row for how often this answer was given.
Amount— CountThe count behind every percentage in the row — SPSS calls it Frequency.
Percentage— PercentageThe share among everybody the question applied to, including those who did not answer — SPSS calls it Percent. To describe the answers themselves, use Valid Percentage.
Valid Percentage— Valid percentageThe share among those who answered — the percentage usually reported: "38% chose normal". SPSS calls it Valid Percent.
SPSS's Cumulative Percent is not reported: for an ordered scale add up Valid Percentage row by row.
How it is computed
Every selected column is counted on its own: each answer (value, label, or range of labels) gets a row.
Without labels numbers go ascending and text alphabetically, as SPSS FREQUENCIES; labels keep their own order; _other, missing and not applicable last.
Percentage is out of all rows in the range except not applicable ("."); Valid Percentage — out of the valid answers (without missing, not applicable, and _other when the labels are closed). Rounded to 2 decimals. Amount, Percentage and Valid Percentage are SPSS's Frequency, Percent and Valid Percent; Cumulative Percent is not reported.
Errors
A column name that does not exist: one cell "Column nope does not exist".
About STATS_FREQUENCIES
STATS_FREQUENCIES counts the answers of each chosen column, for example every question of a Google Forms survey at once. The result is one table with the columns Variable, Group, Amount, Percentage and Valid Percentage; they are the Frequency, Percent and Valid Percent of SPSS. The table recalculates by itself when new responses arrive.
Groups follow the value labels of the column when it has them; otherwise numbers go ascending and text alphabetically, as in SPSS FREQUENCIES. You can also set the groups in the formula: exact values ("male:1,female:2") or ranges ("low:1:3,high:3:"), where a range includes its lower bound and not its upper one. A value outside the labels is counted in the group "_other".
Percentage is out of all rows except not applicable; Valid Percentage is out of the valid answers only. Empty answers are counted in a "missing" row, and the sign "." in a "not applicable" row. Cumulative Percent is not reported. Every number of the report is explained on this page in plain words.