How to check if a value exists in a list
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Test whether a value appears anywhere in a column — membership, allow-lists, validation.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =COUNTIF(A2:A100,D2)>0 | Returns TRUE/FALSE. Wrap in IF for custom labels. |
| Google Sheets | =COUNTIF(A2:A100,D2)>0 | Identical. |
| LibreOffice Calc | =COUNTIF(A2:A100,D2)>0 | Identical. |
How it works
COUNTIF counts the matches and the >0 turns it into a clean TRUE/FALSE — "banana" is in the list. This beats the MATCH/ISNUMBER combination for readability and the two behave identically for exact values. Caveats worth knowing: COUNTIF is case-insensitive, and if the probe value contains * or ? they act as wildcards — use SUMPRODUCT(--EXACT(...)) when case or literal symbols matter.
Verified, not just documented
We ran =COUNTIF(A2:A4,D2)>0 in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned True — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned True for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
COUNTIF — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to count cells that contain specific text
- How to count cells greater than a value
- How to count cells above the average
- How to count cells not equal to a value
- How to count checked checkboxes