Function Problems

Count Cells with IF Instead of COUNTIF in Excel

Algirdas JasaitisAlgirdas Jasaitis Dec 2, 2026 868 views

Question details

Count employees in the Sales department using IF without using COUNTIF.

Count Cells with IF Instead of COUNTIF in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
Department names are listed in a worksheet, and the user needs to count the rows that match Sales.
Observed behavior
The desired result is the number of cells in the department range that contain Sales.
Before you start

Identify the cells containing department names; the examples below use B2:B6 and exclude the header. Check your Excel version so you know whether the SUM and IF formula needs array entry.

Solution 1Recommended

Count Sales employees with SUM and IF in Excel

Use IF to test each department cell and SUM to add the matching results.

1
Select a result cell

Click an empty cell where you want the employee count to appear.

2
Enter the formula

Type =SUM(IF(B2:B6="Sales",1,0)) in the cell or formula bar. Replace B2:B6 with your department range if needed.

3
Confirm the formula

Press Enter in Microsoft 365 or Excel 2021. In older Excel versions, press Ctrl+Shift+Enter to enter it as an array formula.

Count Sales employees with SUM and IF in Excel
How the formula works: IF returns 1 for each cell that matches Sales and 0 for each nonmatching cell; SUM adds those values.
Count departments in WPS Spreadsheets

Count Sales employees with IF in WPS Spreadsheets

Open your worksheet in WPS Spreadsheets and use SUM with IF to count department entries without COUNTIF.

  1. 1. Open the workbook: Launch WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Choose a result cell: Click an empty cell outside the department data.
  3. 3. Enter the formula: Type =SUM(IF(B2:B6="Sales",1,0)), replacing B2:B6 with the cells that contain department names.
  4. 4. Confirm the formula: Press Enter. If your WPS version requires array entry for this formula, select the formula cell and confirm it with Ctrl+Shift+Enter.
Count matching department entries with SUM and IFOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceAccess spreadsheet tools for free
microsoft office alternative - wps office

Frequently Asked Questions

How do I count a department named in another cell?

If D2 contains the department name, enter =SUM(IF(B2:B6=D2,1,0)). In older Excel versions, confirm it with Ctrl+Shift+Enter.

Why does my SUM and IF formula need Ctrl+Shift+Enter?

Older Excel versions require array entry to evaluate IF across a range. Microsoft 365 and Excel 2021 can confirm this formula with Enter.

Can I count Sales without IF or COUNTIF?

Yes. Enter =SUMPRODUCT(--(B2:B6="Sales")) in an empty cell and press Enter.

Does the formula count partial matches such as Sales Operations?

No. The comparison B2:B6="Sales" counts cells equal to Sales, not cells containing additional text.