Practice / Lookup & Reference

Flag a double-booked order (COUNTIF)

Easy Lookup & Reference

A customer swears they were charged twice, and the order log looks suspicious: order ID ORD-1042 might have been booked more than once. Before refunding anything, count how many rows in A2:A11 carry that exact ID. The disputed ID is already sitting in D1. Put the answer in the Occurrences cell D2.

Your solution should use cell references so it updates automatically when Test Case input values change.

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.

Notes

COUNTIF's second argument is the criteria. Text criteria needs quotes: "ORD-1042". The match is exact (but not case-sensitive): "ord-1042" works too. This is the same engine behind conditional formatting's Duplicate Values rule and Sheets' custom formula =COUNTIF($A$2:$A$11,A2)>1 — count first, then act.

Function guide

FAQ

How do I find duplicates in Excel with COUNTIF?

Add a helper column with =COUNTIF($A$2:$A$11,A2) and fill down — any value greater than 1 is a duplicate. Filter or conditional-format on that column to see them all at once.

How do I highlight duplicates in Google Sheets?

Select the range, then Format → Conditional formatting. Under Format rules choose Custom formula is and enter =COUNTIF($A$2:$A$11,A2)>1, then pick a fill color.

Is COUNTIF case-sensitive?

No. "ORD-1042" and "ord-1042" both match. If you ever need a case-sensitive count, use SUMPRODUCT with EXACT: =SUMPRODUCT(--EXACT(A2:A11,"ORD-1042")).