Count Cells with IF Instead of COUNTIF in Excel
Question details
Count employees in the Sales department using IF without using COUNTIF.

- 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.
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.
Count Sales employees with SUM and IF in Excel
Use IF to test each department cell and SUM to add the matching results.
Click an empty cell where you want the employee count to appear.
Type =SUM(IF(B2:B6="Sales",1,0)) in the cell or formula bar. Replace B2:B6 with your department range if needed.
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 SUMPRODUCT
Use this alternative if IF is not required and you want to avoid a special array-entry shortcut.
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. Open the workbook: Launch WPS Spreadsheets and use Open to select your Excel workbook.
- 2. Choose a result cell: Click an empty cell outside the department data.
- 3. Enter the formula: Type =SUM(IF(B2:B6="Sales",1,0)), replacing B2:B6 with the cells that contain department names.
- 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.

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.




