logo
search
Formula Errors

How to Use Absolute Cell References in Excel COUNTIF Formulas

Maira MehtabMaira Mehtab Sep 22, 2026 869 views

Question details

The user needs to correctly apply absolute cell references within a COUNTIF formula to lock the range when copying it, and to resolve syntax errors in their current formula.

Product
Excel
Device & OS
not provided
Scenario
Applying a COUNTIF formula across multiple cells without the reference range shifting down or across.
Observed behavior
The formula =COUNIF($B2:$B9,”MA”) fails due to misspelled function names, incorrect quotation marks, and mixed references instead of fully locked absolute references.
Before you start

Double-check that your function name is spelled correctly (COUNTIF instead of COUNIF) and ensure you are using standard straight quotes ("") rather than smart quotes (“”) for your criteria.

Solution 1Recommended

Use the F4 Key to Apply Absolute References

The quickest way to lock a cell range in Excel is by using the F4 keyboard shortcut while editing your formula.

Using absolute references ensures that when you copy a formula down a column or across a row, the specified range remains exactly the same. The dollar signs ($) indicate that the row and column are locked.

1
Select the cell

Click the cell where you want to enter or edit your COUNTIF formula.

2
Enter the formula and range

Type =COUNTIF( and use your mouse to highlight the desired cell range, for example, B2:B11.

3
Press the F4 key

Immediately after selecting the range, press the F4 key on your keyboard. This changes the relative reference (B2:B11) to an absolute reference ($B$2:$B$11).

4
Complete the formula

Type a comma, enter your criteria in straight quotes (e.g., "CO"), close the parentheses, and press Enter.

Laptop Function Keys: On many laptops, the function keys default to multimedia controls. If pressing F4 doesn't work, hold the 'Fn' key and press 'F4' simultaneously.

Master Formulas Easily with WPS Spreadsheet

WPS Office provides a powerful, fully compatible spreadsheet tool that perfectly supports standard Excel formulas like COUNTIF. You can use identical syntax and keyboard shortcuts to perform complex data analysis efficiently.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your data.
  2. 2. Start the formula: Select an empty cell and type =COUNTIF( to begin the calculation.
  3. 3. Lock the range with F4: Highlight your target range using the mouse, then press F4 to automatically add the $ signs for an absolute reference.
  4. 4. Finish and apply: Enter your condition in quotation marks, close the bracket, and press Enter. Drag the formula down to apply it seamlessly.
Fully compatible with Microsoft Excel formulas, functions, and file formats (.xlsx).Supports standard F4 and Fn+F4 shortcuts for easily adding absolute references.Lightweight software with a fast, intuitive tabbed interface.Free to use for everyday data analysis and spreadsheet tasks.
microsoft office alternative - wps office

Frequently Asked Questions

What is the difference between relative, absolute, and mixed references in Excel?

Relative references (like A1) change based on the relative position when a formula is copied. Absolute references (like $A$1) remain strictly locked to a specific cell. Mixed references lock either the row (A$1) or the column ($A1).

Why is my COUNTIF formula returning a #NAME? error?

This error usually occurs if the function name is misspelled. For instance, typing 'COUNIF' instead of the correct 'COUNTIF' will prompt Excel to return a #NAME? error because it does not recognize the command.

How do I toggle through different reference types using F4?

When you highlight a cell reference in the formula bar and press F4 repeatedly, Excel cycles through all variations: absolute ($A$1), mixed row (A$1), mixed column ($A1), and back to relative (A1).

Why does my COUNTIF formula show an error when using quotation marks?

Excel formulas require standard straight quotation marks ("") for text criteria. If you copied a formula from a word processor or website, it might contain smart or curly quotes (“”), which Excel cannot process correctly. Replace them with straight quotes.