How many orders landed in the period (COUNTIFS)

Medium Math
Description
Hints 0/4
Solutions 2
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

The problem

Problem statement

The ops review asks for the number of orders placed inside a custom period, not a month. Dates sit in B2:B6 as ISO text, and the period limits are F1 (from) and F2 (to), both inclusive. Put the count in the Orders cell F3.

Both limits come from F1 and F2 — the same formula must work when the period moves.

Problem data

Show the sheet as a table (selectable, copyable)
The exercise data, as a table
ABCEF
1OrderDateAmountFrom2026-02-01
2SO-12026-01-20120To2026-03-05
3SO-22026-02-0380Orders
4SO-32026-02-18300
5SO-42026-03-0160
6SO-52026-03-15210

Notes

Two criteria on the same range is allowed: COUNTIFS(B2:B6, ">="&F1, B2:B6, "<="&F2). The operators are strings joined to the cell with &, and ISO dates compare correctly as text because year comes first. Inclusive limits mean an order dated exactly F1 or F2 counts.

How to approach

Your answer goes in F3. On submit we re-run your formula against 3 different sets of input, so a hardcoded number will fail — the formula has to follow the cells.

  1. Target cell is F3
  2. COUNTIFS takes range/criteria pairs
  3. Two pairs, both on B2:B6, joined with &
  4. Shape: =COUNTIFS(?, ?, ?, ?)

Official solutions

Show 2 solutions — try it yourself first

Approach 1: two criteria on one range

=COUNTIFS(B2:B6, ">="&F1, B2:B6, "<="&F2)

2026-02-01 to 2026-03-05 takes in SO-2 (02-03), SO-3 (02-18) and SO-4 (03-01): 3 orders. SO-1 is too early and SO-5 too late.

Approach 2: subtract the ones before the window

=COUNTIFS(B2:B6, "<="&F2) - COUNTIF(B2:B6, "<"&F1)

Everything up to F2 is 4 orders, minus the 1 placed before F1, leaves 3. Subtraction of counts is the same logic and is often easier to audit.

Function guide

Related practice

FAQ

How do I count records between two dates?

=COUNTIFS(range, ">="&start, range, "<="&end). Both criteria target the same date column and both limits are inclusive.

Why does my date criteria return 0?

The operator is inside the quotes and the cell is outside: "<="&F2. Writing "<=F2" compares against the literal text F2.