When you’re importing data or pasting from different sources—or when multiple users enter data into your Google Sheets—you may encounter inconsistent casing in values like item codes, employee IDs, or reference numbers. Some entries might begin with uppercase letters, while others are all lowercase or a mixture of both.
As part of your data cleanup process, it helps to check if the first N characters in a string are all capital (uppercase) or small (lowercase). Thankfully, Google Sheets offers straightforward formulas to handle this task.
This tutorial shows how to check if the first N letters are caps or small in Google Sheets, using both strict and flexible methods.
Check First N Characters Are Uppercase (Strict)
Let’s start with a dataset in A1:A4:
ABCD123
ABC1D23
ABcD123
TE_S123
We want to check if the first 4 characters in each cell are exactly uppercase letters (A–Z)—no digits, symbols, or lowercase letters allowed.
Formula – Non-Array Version
In cell B1, enter:
=REGEXMATCH(LEFT(A1, 4), "^[A-Z]{4}$")
Drag this formula down as needed.
Formula – Array Version
To apply the same logic across the range with a single formula, use:
=ArrayFormula(REGEXMATCH(LEFT(A1:A4, 4), "^[A-Z]{4}$"))
This will spill results for the entire list in one go.
What Does “Strict” Mean in This Context?
“Strict” here means that the check only passes if the first N characters are all uppercase alphabetic letters (A–Z). It excludes digits, spaces, underscores, and any other non-letter characters.
Examples of valid inputs (for N=4):
ABCD123→TRUEABC1D23→FALSE(contains a digit in the first 4 characters)AB_C123→FALSE(underscore not allowed)Abcd123→FALSE(mixed case)
This strict rule is especially useful when validating formats like:
- Product codes:
ABCD1234 - Department tags:
ADMN-5678 - User IDs that must start with exactly 4 uppercase letters
Here’s a brief explanation of the formula:
Formula Breakdown
=REGEXMATCH(LEFT(A1, 4), "^[A-Z]{4}$")
LEFT(A1, 4): Extracts the first 4 characters from cell A1."^[A-Z]{4}$": A regular expression that matches exactly 4 uppercase letters (A–Z).^= start of the string[A-Z]{4}= exactly 4 uppercase letters$= end of the string
- REGEXMATCH: Returns
TRUEif the extracted 4 characters match the pattern; otherwise,FALSE.
Summary:
This formula checks if the first 4 characters in A1 are strictly uppercase letters only—no numbers, symbols, or lowercase letters.
Check First N Characters Are Lowercase (Strict)
To check whether the first N characters are all lowercase, just replace [A-Z] with [a-z] in the previous formula.
Formula – Non-Array Version
=REGEXMATCH(LEFT(A1, 4), "^[a-z]{4}$")
Formula – Array Version
=ArrayFormula(REGEXMATCH(LEFT(A1:A4, 4), "^[a-z]{4}$"))
These formulas ensure that only lowercase alphabetic letters (a–z) are present in the first 4 characters.
Alternative – Ignore Digits and Symbols
If you want a looser check—where you only care that the visible letters are uppercase or lowercase, even if other characters (like numbers or symbols) are included—you can use the EXACT and UPPER or LOWER functions.
This approach checks whether the first N characters, as-is, match their uppercase or lowercase equivalents.
Formula to Check If First 4 Characters Are Uppercase
=EXACT(LEFT(A1, 4), UPPER(LEFT(A1, 4)))
- Returns
TRUEif the first 4 characters are all uppercase—even if non-letters are present (e.g.,AB_1).
Formula to Check If First 4 Characters Are Lowercase
=EXACT(LEFT(A1, 4), LOWER(LEFT(A1, 4)))
- Returns
TRUEif the first 4 characters are all lowercase.
Array Versions
=ArrayFormula(EXACT(LEFT(A1:A4, 4), UPPER(LEFT(A1:A4, 4))))
=ArrayFormula(EXACT(LEFT(A1:A4, 4), LOWER(LEFT(A1:A4, 4))))
Conclusion
If you’re cleaning up data in Google Sheets and want to ensure consistent formatting, checking whether the first N letters are caps or small can help you catch errors early. You can use strict regex-based checks for letter-only matches, or a more flexible EXACT + UPPER/LOWER approach to allow other characters.
These tools are especially useful in datasets where naming conventions and formatting rules are enforced, such as:
- Inventory systems
- Payroll and employee databases
- Invoice or order reference sheets





















