DSTDEV in ONLYOFFICE: Sample Standard Deviation for Matching Records
Calculate conditional sample standard deviation, reconstruct squared deviations, and distinguish population scaling and source-predicted singleton errors.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =DSTDEV(A1:D6,"Amount",Q1:Q2) has the independent target 10 for matching values 10,20,30. It uses the sample divisor n−1, then takes the square root.
Syntax and arguments
=DSTDEV(database, field, criteria)
Database includes its first-row headers. Field is a quoted header or a one-based column position within that database. Criteria is a separate block with recognized headers and at least one condition row. The official help documents this three-argument interface. Keep headers unique in the database and copy criteria headers exactly.
Build the database and criteria blocks
Create a blank sheet named DatabaseChecks. Enter this database in A1:D6, including the header row. Entries marked empty must be genuinely empty cells, not the word “empty”, a space or a formula returning empty text.
| Row | A: ID | B: Team | C: Amount | D: Note |
|---|---|---|---|---|
| 2 | 101 | East | 10 | ready |
| 3 | 102 | West | 40 | ready |
| 4 | 103 | East | 20 | empty |
| 5 | 104 | East | 30 | hold |
| 6 | 105 | North | 0 | ready |
These are fictional records. Amount is deliberately numeric, including a genuine zero. Note provides a separate text/blank field for count comparisons. Headers are unique and consistent.
Build these separate criteria blocks; none overlaps A1:D6:
| Purpose | Exact entries | Range |
|---|---|---|
| East only | Q1 Team; Q2 East | Q1:Q2 |
| East AND amount at least 20 | F1 Team; G1 Amount; F2 East; G2 >=20 | F1:G2 |
| East OR West | I1 Team; I2 East; I3 West | I1:I3 |
| No matching team | K1 Team; K2 South | K1:K2 |
| All records | M1 Team; M2 genuinely empty | M1:M2 |
| Unique ID 103 | O1 ID; O2 numeric 103 | O1:O2 |
| Unique ID 105 | S1 ID; S2 numeric 105 | S1:S2 |
Enter >=20 as criterion text, not a formula. Place result formulas in U2:U15, outside every data/criteria block. The extra spaces used in this explanation are not part of the header text.
Reconstruct the sample deviation
The East values have mean 20. Their deviations are−10,0,10, and the squared deviations are 100,0,100. Sum 200 divided by 3−1 gives sample variance 100; its square root is standard deviation 10.
On a separate calculation area, enter 10,20,30 in W2:W4. Put =AVERAGE(W2:W4) in Y2, =(W2-$Y$2)^2 in X2 and fill through X4. =SQRT(SUM(X2:X4)/(COUNT(W2:W4)-1)) has target 10. This is an independent numeric reconstruction, not an application test or a replacement for checking which records matched.
Worked criteria changes
| Formula | Target |
|---|---|
=DSTDEV(A1:D6,"Amount",Q1:Q2) |
10 |
=DSTDEV(A1:D6,3,F1:G2) |
7.07106781186548 |
=DSTDEV(A1:D6,"Amount",I1:I3) |
12.9099444873581 |
=DSTDEV(A1:D6,"Amount",M1:M2) |
15.8113883008419 |
For the AND subset 20,30, squared deviations sum to 50 and n−1=1. For East/West 10,40,20,30, the sum is 500 and divisor 3. For all five records, mean 20 and squared-deviation sum 1000 give 1000/4=250 before taking the square root. North’s real zero is included by the blank criterion.
Advanced: sample versus population and units
For the East subset, DSTDEVP instead has target √(200/3)=8.16496580927726. The sample standard deviation is larger because its divisor is smaller. The ratio is √(3/2), not 3/2; that latter ratio applies to variances.
Choose the sample interpretation when the selected observations are a sample of a larger population. The formula cannot make a biased selection representative. Standard deviation has the same units as Amount; DVAR has squared units. Adding a constant to every selected amount preserves the deviation, while multiplying them by c multiplies standard deviation by |c|. These are mathematical identities, not additional native tests.
Singleton, no-match and mixed-type cautions
With no South match, the source explicitly returns the division-by-zero error. A singleton is different in this revision: with O1:O2 selecting just 20, the code only checks for zero count, then calculates 0/(1−1). That creates NaN; the checked number constructor converts a nonfinite numeric result to #NUM!. Thus singleton #NUM! is source-predicted, not a claimed native screenshot or the generic #DIV/0! expectation from another product.
The source parses raw values numerically. Numeric-prefix text can therefore affect the count and mean; do not claim that every text cell is ignored. All-nonnumeric selected values produce the explicit zero-count division error. Keep the main field numeric, and verify the matching count before reporting a sample statistic.
Criteria logic and important ONLYOFFICE source limits
Conditions in one criteria row are combined with AND; separate rows supply OR alternatives. The first main OR row above matches East, and the second matches West. A record matching both alternatives is collected once in the inspected helper.
A blank criterion means no restriction for that column in the checked source. Thus M1:M2 selects all records; it is not a request to find blank Team cells. An accidental blank OR row can similarly broaden the selection. Keep the criteria rectangle tight rather than including unused rows for convenience.
Bare text is another trap: the helper appends a wildcard to a text criterion without an operator. East can therefore match a longer prefix such as Eastside. This database contains no such team, so the main results are unambiguous. To request explicit equality in a future test, store =East as text, for example by typing a leading apostrophe before it; do not accidentally enter it as a formula. Wildcard, case and locale edge behavior needs its own bounded validation.
There is also a version-specific OR caveat. The inspected helper can return early when the first recognized criteria row has no matches, before considering later OR rows. Do not promise order-independent OR behavior from this implementation. Reversing a deliberately unmatched first row and a matching second row is a separate source-predicted regression probe, not a native test performed here.
Unknown criterion headers are not a safe way to request “no match”: the helper skips unrecognized headers and, if none are recognized, can select every record. Copy valid headers exactly and distinguish a misspelled criterion heading from an unknown selected field. These observations come from the shared source helper, not from applying another product’s database-function rules.
Related functions
Availability, compatibility and verification
The function is currently documented in ONLYOFFICE’s unversioned Spreadsheet Editor help. Its first introduction release/date, final supported version and any retirement announcement are not established by these sources. Documentation presence does not establish support in every older Desktop Editors build, Docs deployment or mobile client.
This guide checks official SDKJS tag v10.0.0.169, commit 3679e0375a758d7dc59d31337a45461be3525ed8, alongside current help on October 18, 2026. Main arithmetic is independently calculated; implementation-specific branches are labeled source-predicted. No ONLYOFFICE engine or application was executed for these examples. No native screenshots or recalculated workbook are claimed.
Formulas use English names and comma separators. Adapt separators to the actual editor locale. Similar function names elsewhere do not guarantee identical criteria matching, text coercion, errors or blank-field handling. Keep the database header in the formula range and preserve genuinely empty cells when transferring the example.
References checked October 18, 2026
- Official DSTDEV reference: purpose and arguments.
- Pinned shared criteria helper: matching and selected-field handling.
- Pinned DSTDEV calculation: operation-specific implementation.
- Pinned numeric-result constructor: nonfinite numeric-result handling.