Skip to content

Concept preview by SkillEra.IO, LLC. These sites have no accounts or forms; analytics and the external contact page are covered in Privacy.

Back to Formula Lab

Formula Lab: what this practice sheet supports

Formula Lab grades formulas with its own evaluator. It is not Excel. Every rule below was checked against Microsoft Excel 365 (version 16.0, build 20625). For each rule there are cases in formula/cases.json, and the results Excel returned for them are in formula/excel-golden.json. A formula that falls outside these rules gets "That's not supported in this practice sheet". It is never given a guessed answer.

Families in this release: Logic, Math, Conditional (SUMIFS, COUNTIFS, AVERAGEIFS, MAXIFS, MINIFS), Lookup (VLOOKUP, HLOOKUP, INDEX, MATCH, XLOOKUP, XMATCH) and Text (LEFT, RIGHT, MID, LEN, TRIM, UPPER, LOWER, PROPER, CONCAT, TEXTJOIN, FIND, SEARCH, SUBSTITUTE). Coming later: LET, dates and dynamic arrays (FILTER, SORT, UNIQUE).

Formulas

  • A formula starts with =. The whole formula must make sense; leftover text is not supported (=A1 B1).
  • Numbers: 12, 1.5, .5, 1E3. Digits past the 15th significant digit are dropped (Excel does the same: 1234567890123459 is 1234567890123450). The largest number you can type is 9.99999999999999E+307; Excel refuses a formula with a bigger one, so it is not supported here either.
  • A formula can't refer to the answer cells (that would be circular).
  • Text in double quotes; "" inside text is one quote mark. Text keeps its case.
  • TRUE and FALSE.
  • Error values: #N/A, #DIV/0!, #VALUE!, #REF!, #NUM!. Other error values (#NAME?, #NULL!, #SPILL!, #CALC! and the rest) are not supported.
  • Cell references A1, $A1, A$1, $A$1 and ranges A1:B5, within the practice sheet (at most 30 rows, columns A–J). Not supported: other sheets (Sheet1!A1), names (Total), whole columns, array constants ({1,2}), and the space (intersection) operator.
  • Function names, TRUE/FALSE, error values and references ignore case (=sUm(a1:B2)).
  • Spaces and line breaks between parts are fine. A space between a function name and ( is not.
  • A range only goes inside a function that accepts one (see the table). =A1:A2 on its own or =A1:A2+1 would spill in Excel, so it is not supported here.
  • Limits: 1,000 characters, 500 parts, 32 levels of brackets and nesting, 10,000 cells read.

Operators, in Excel's order (highest first)

OrderOperatorNotes
1:range
2- + (sign)=-2^2 is 4: the sign binds tighter than ^
3%divides by 100: =2*3% is 0.06, =50%% is 0.005
4^left to right: =2^3^2 is 64
5* /left to right
6+ -left to right
7&joins text: ="a"&1+1 is a2
8= <> < <= > >=left to right: =1<2=TRUE is TRUE

Arithmetic (+ - * / ^, sign, %)

  • TRUE is 1, FALSE is 0, an empty cell is 0.
  • Text that looks like a number is used as one, spaces around it included (" 7 "+1 is 8). Other text, including empty text "", gives #VALUE!. Text that Excel reads as a date, time, money or percentage ("11-2257", "50%") is a number to Excel; that reading isn't modelled, so it is not supported.
  • With errors on both sides, the left one wins. Text on the left that can't be a number gives #VALUE! before an error on the right is looked at.
  • x/0 is #DIV/0!. 0^0 is #NUM!. 0^-1 is #DIV/0!.
  • A negative number to a fractional power is #NUM!, except odd roots: (-8)^(1/3) is -2, (-32)^0.2 is -2. (-8)^0.5 and (-8)^(2/3) are #NUM!.
  • A result too large for Excel is #NUM! (also from SUM and AVERAGE). Number text larger than Excel's largest number ("1E309") is not a number, so it gives #VALUE!.

Joining text (&)

  • TRUE and FALSE join as TRUE and FALSE; an empty cell as nothing.
  • A number joins as Excel writes it: rounded to 15 significant digits, written out in full if that takes at most 20 characters (the minus sign not counted), otherwise in scientific notation: 1E+20, 1.23E-17, 3.33333333333333E-06. Scientific text also stays within 20 characters, so a three-digit exponent costs a digit: 2^1000 is 1.0715086071863E+301.
  • An error on either side is the result (left one first).

Comparisons

  • Numbers come before text, and text before TRUE/FALSE: =5<"5" is TRUE.
  • Text compares without case: ="Apple"="apple" is TRUE. = and <> compare the letters as they are (="co-op"="coop" is FALSE).
  • Putting text in order follows Excel, not character codes: at the first character that differs, a space or a punctuation mark comes before a digit, and a digit before a letter (="~x"<"m" and ="_"<"a" are TRUE). Not supported, because Excel's order there wasn't measured: two different punctuation marks at that point, a space against a punctuation mark, hyphens and apostrophes anywhere (Excel's sort skips them), and letters outside A–Z.
  • An empty cell counts as 0, "" or FALSE, whichever matches the other side.
  • An error on either side is the result.

Fill down

A formula is entered in the top answer cell and filled down to the other answer cells. A reference row without $ moves down with it, a row with $ stays put, and columns never move (answers are one column wide). For example, =SUM(B$1:B1) filled two rows down is =SUM(B$1:B3). A filled reference that would leave the practice sheet is not supported.

Logic

FunctionAcceptsBehavior
IF(test, then, [else])valuesWithout else, a false test gives FALSE. Only the chosen branch is worked out, so an error in the other branch doesn't matter. The test is read as below. A blank result shows as 0.
IFS(test1, value1, …)values, in pairsThe first true test wins; none true gives #N/A. An error in a test is the result. An odd number of arguments is not supported.
IFERROR(value, value_if_error)valuesAny error in value gives value_if_error. A blank value shows as 0.
IFNA(value, value_if_na)valuesOnly #N/A is replaced; other errors pass through.
AND(…), OR(…)values or rangesIn ranges, numbers and TRUE/FALSE count, and text and empty cells are skipped. Typed directly, numbers and TRUE/FALSE count, text "TRUE"/"FALSE" (any case) counts, and other text is skipped (even "0"). With nothing to count, the result is #VALUE!. Any error is the result; an error typed directly wins over one in a range, whatever the order (see Math).
NOT(value)one value

How a test is read (IF, IFS, NOT): a number is true unless 0. TRUE/FALSE as they are. Text "TRUE"/"FALSE" in any case. An empty cell is false. Other text gives #VALUE!. An error is the result.

Math

FunctionAcceptsBehavior
SUM, AVERAGE, MIN, MAXvalues or rangesIn ranges and cell references, only numbers count: text (even "5"), TRUE/FALSE and empty cells are skipped. Typed directly, numbers, TRUE/FALSE and numeric text count, and other text gives #VALUE!. Any error is the result; with several, an error (or #VALUE! from text) in a directly typed argument wins over one inside a range or cell reference, whatever their order (MAX(A1:A2,"x") is #VALUE! even when A1 is #N/A), and otherwise the first range error wins. CONCAT and TEXTJOIN follow the same rule. INDEX, XLOOKUP, IF and IFS can hand back a cell, which Excel then reads as a reference (in Excel, SUM(INDEX(B1:B2,2)) is 0 when B2 is the text "5"). The practice sheet doesn't track whether a call returned a cell, so a call to one of these inside SUM, AVERAGE, MIN, MAX, COUNT, COUNTA, AND or OR is supported only when it gives a number (or TRUE/FALSE, for AND and OR), and inside CONCAT or TEXTJOIN only when it isn't an error. IFERROR, IFNA and VLOOKUP give plain values. AVERAGE of nothing is #DIV/0!. MIN and MAX of nothing are 0.
COUNTvalues or rangesCounts numbers: in ranges only real numbers; typed directly, numbers, TRUE/FALSE and numeric text. Errors are not counted (no error result).
COUNTAvalues or rangesCounts every non-empty cell, including "" and errors; typed directly, every argument counts.
ROUND(number, digits)valuesHalves round away from zero (ROUND(-2.5,0) is -3). Rounds the decimal value you see, so ROUND(2.675,2) is 2.68. Digits are cut to a whole number (2.9 → 2, -1.5 → -1). Negative digits round to tens, hundreds, ….
ABS(number)one value

A range passed where a single value is expected (ROUND(B1:B2,0), NOT(B1:B2), IF(A1:A2,…)) would spill in Excel, so it is not supported here.

Conditional

FunctionAcceptsBehavior
COUNTIFS(range1, criteria1, …)ranges and criteria, in pairsCounts the positions where every criteria holds.
SUMIFS(sum_range, range1, criteria1, …)a range, then pairsAdds the numbers of sum_range at those positions; text, TRUE/FALSE and empty cells there are skipped. An error there is the result. Nothing matching gives 0.
AVERAGEIFS(average_range, …)a range, then pairsLike SUMIFS, averaged. No numbers to average gives #DIV/0!.
MAXIFS(max_range, …), MINIFS(min_range, …)a range, then pairsLike SUMIFS; nothing matching gives 0.

All ranges must be the same shape (rows and columns), or the result is #VALUE!. The ranges may be 2-D; positions are matched cell for cell. A criteria range must be a range or a cell reference; a criteria must be one value (a range there would spill in Excel). An odd number of arguments is not supported.

How a criteria is read. It can be a value (5, TRUE, a cell) or text with an optional operator in front: =, <>, <, <=, >, >= (">=30", "<>North", ">"&E3).

CriteriaMatches
A number, "5", "=5", " 5", "1e1"Numbers equal to it, and text that reads as that number ("5"). Numbers are compared at 15 significant digits, so 0.1+0.2 matches 0.3. TRUE is not 1.
"<>5"Everything except the number 5: the text "5", empty cells and errors all count.
">4", "<=10"Numbers only (the text "5" doesn't count).
TRUE, "TRUE", "true"Only TRUE (not the text "TRUE"). "<>TRUE" matches everything else.
Text: "North", "n*", "a?c"Text cells equal to it, ignoring case. Text with a * or ? in it is a pattern: * stands for any run of characters, ? for one, and ~ makes the next character literal ("N~*rth" is N\*rth, "~~*" is a ~ then anything). A ~ at the end of a pattern is not supported. Text without * or ? is compared as it is, ~ included ("~x" is ~x). Numbers never match text criteria; "*" matches every text cell, "" included.
"<>North", "<>N*"Everything that doesn't match, empty cells and numbers included.
">m", "<b"Text cells only, in Excel's text order (see Comparisons); * and ? are literal here.
"="Empty cells only.
"<>"Every cell that isn't empty ("" counts as not empty).
""Empty cells and "".
"<", ">"Nothing.
An error value or "#N/A"Cells with that error. An error in a criteria is never the result.
An empty cellThe number 0.

Not supported: criteria text that Excel would read as a date, time, money, a percentage or a number with commas ("1/2", "5%", ">$5", "1,000", "Jan 5"), and "<=" or ">=" with nothing after them. A sheet cell with such text is not supported when a number criteria has to read it. Errors in the criteria ranges never stop the function; they only match error criteria.

Lookup

FunctionBehavior
VLOOKUP(value, table, col, [approx])Finds value in the table's first column and returns the cell col columns in. approx defaults to TRUE. Not found is #N/A, even when col is also wrong. Found: col below 1 is #VALUE!, past the table is #REF!. col is cut to a whole number and may be numeric text ("2"). Typed text or an error as col ("two", 1/0) is the result before anything is looked up. A col read from a cell is only used after a match: TRUE counts as 1, numeric text works, an empty cell is #VALUE!, and other text or an error there is #REF!. A col worked out by a function that gives text or an error is not supported (Excel treats those differently by function). approx may be 0/1, TRUE/FALSE or "TRUE"/"FALSE".
HLOOKUP(value, table, row, [approx])The same, across the first row.
INDEX(range, row, [col])The cell at row (and col). Numbers are cut to whole numbers; negative is #VALUE!; past the range is #REF!. On a single row or column, one number counts along it. One number on a range that is several rows and columns is #REF!. A 0 that picks a whole row or column spills in Excel, so it is not supported (it is fine when that row or column is one cell); inside another function (MAX(INDEX(B1:C1,0))) Excel uses the cells as a list, which is not supported either.
MATCH(value, range, [type])The position of value in one row or column; a 2-D range gives #N/A. type defaults to 1; any positive number acts as 1, any negative as -1, 0 is an exact match.
XLOOKUP(value, lookup, return, [if_not_found], [match_mode], [search_mode])Finds value in lookup (one row or column) and returns the matching cell of return, which must be the same direction and length (else #VALUE!). A 2-D lookup is #VALUE!. A 2-D return lined up with lookup would spill, so it is not supported. Not found gives if_not_found (only worked out when needed) or #N/A.
XMATCH(value, range, [match_mode], [search_mode])The position, with XLOOKUP's modes. A 2-D range is #VALUE!.

Exact matches need the same kind of value: 103 doesn't find the text "103". Text ignores case. VLOOKUP, HLOOKUP and MATCH 0 understand wildcards in a text value: *, ?, and ~ before any character makes it literal ("x~*" finds x*; "~~x" finds ~x; "~x" finds x), with or without a * or ? in the value (criteria differ here). A ~ at the very end is not supported. Error cells in the searched range are skipped. An empty cell as the value means 0 for VLOOKUP, HLOOKUP and MATCH; for XLOOKUP and XMATCH it finds an empty cell, and "" finds "" text.

Approximate matches (VLOOKUP/HLOOKUP TRUE, MATCH 1 and -1) need the searched values sorted: smallest first (largest first for MATCH -1), all numbers or all text, with no empty or error cells. Then the result is the last value not larger than value (for -1, the last value not smaller); with repeats, the last of them. A value of the other kind (text in a number column) is not found. On unsorted or mixed data Excel's answer depends on how its search happens to run, so that is not supported here; use an exact match.

XLOOKUP and XMATCH modes. match_mode 0 (default) is exact without wildcards; 2 is exact with wildcards; -1 and 1 take an exact match, else the next smaller or next larger value, on unsorted data too; with ties, the first in search order. Numbers rank below text: text with no smaller text takes the largest number, and a number with no larger number takes the smallest text. The searched values must all be numbers or text; with an empty cell, TRUE/FALSE or an error among them Excel's ranking wasn't consistent, so that is not supported. search_mode 1 (default) searches from the start, -1 from the end. Other numbers are #VALUE!. Positive fractions are cut down (1.9 acts as 1), for every whole-number argument of this family (VLOOKUP's col, INDEX's row and col, the modes); a negative fraction there is not supported. Not supported: match_mode 3 (regular expressions) and search_mode 2 or -2 (binary search).

Text

Text arguments take numbers, TRUE/FALSE and empty cells as Excel writes them (LEFT(1234.5,4) is 1234, LEN(1/3) is 17, an empty cell is ""). An error is the result; when several arguments hold errors, the first one (left to right) wins, even in an argument that ends up unused (SUBSTITUTE(A8,"z",#N/A) is #N/A). Counts and positions: positive fractions are cut down (LEFT("Banana",2.9) is Ba); numeric text and TRUE work ("2", TRUE = 1); a negative fraction is not supported. Text is limited to plain printable ASCII (no accents, tabs or line breaks) and to Excel's cell size of 32,767 characters; anything else is not supported.

FunctionBehavior
LEFT(text, [n]), RIGHT(text, [n])The first or last n characters (default 1). n past the end gives the whole text; 0 gives ""; negative is #VALUE!.
MID(text, start, n)n characters from start. start below 1 or n below 0 is #VALUE!; start past the end gives "".
LEN(text)The number of characters.
TRIM(text)Spaces off both ends, and runs of spaces inside cut to one. Only the space character counts.
UPPER(text), LOWER(text)
PROPER(text)A letter after anything that isn't a letter is capitalized, digits included (2nd → 2Nd, o'neil → O'Neil); all other letters go lower case.
CONCAT(text1, …)Joins values and ranges (row by row).
TEXTJOIN(delimiter, ignore_empty, text1, …)Joins with delimiter between pieces. With ignore_empty TRUE (or 1), empty cells and "" are left out, from ranges and typed values alike. ignore_empty that isn't TRUE/FALSE/a number is #VALUE!. A range as the delimiter is not supported. An error in ignore_empty is the result. An error typed as the delimiter is the result; one read from a cell ranks like a range error, so a typed error among the texts wins over it.
FIND(find, within, [start])The position of find (exact case, no wildcards) from start (default 1). Not found is #VALUE!. start below 1 or more than one past the end is #VALUE!. Empty find gives start.
SEARCH(find, within, [start])Like FIND, ignoring case, with the lookup wildcards: *, ?, and ~ before any character makes it literal ("~*" finds *, "~d" finds d). Unlike FIND, start past the last character is #VALUE!, even with empty find (SEARCH("","abc",4), SEARCH("","")).
SUBSTITUTE(text, old, new, [instance])Replaces old (exact case) with new. Without instance, every match, left to right without overlaps ("Banana", "ana" → BXna); with it, only that match, counting overlapping ones ("ana", 2 → BanX). instance below 1 is #VALUE!; past the last match changes nothing. An empty old changes nothing.