Hàm COUNTIF là một công cụ hữu ích trong việc thống kê và báo cáo số liệu. Nếu bạn chưa biết cách sử dụng hàm này, đừng lo lắng, bài viết dưới đây sẽ hướng dẫn bạn cách ứng dụng hàm đếm có điều kiện thông qua các ví dụ cụ thể. Hãy cùng Phúc Anh tìm hiểu về cách dùng hàm COUNTIF trong Excel nhé!
Hàm COUNTIF là gì?
Hàm COUNTIF trong Excel là một hàm đếm có điều kiện được sử dụng để đếm số lượng ô trong một phạm vi thỏa mãn một điều kiện nhất định. Hàm này thường được sử dụng để đếm số lượng ô trùng lặp hoặc đếm dữ liệu trong các bảng thống kê. Nó hữu ích khi bạn cần đếm số ô chứa giá trị thỏa mãn điều kiện cho sẵn trong bảng dữ liệu của mình.
Hướng dẫn sử dụng hàm COUNTIF trong Excel một cách đơn giản nhất
Bạn cần lọc 1 thông tin dữ liệu đơn giản, có thể sử dụng công thức sau =COUNTIF(ô dữ liệu đầu:ô dữ liệu cuối,”dữ liệu cần lọc”). Nhấn Enter
Ví dụ: =COUNTIF(B2:B8,”dưa hấu”) rồi nhấn Enter. Bạn sẽ nhận được kết quả như sau:
Sử dụng hàm COUNTIF đếm số lượng mặt hàng
Với công thức như trên ta lọc dữ liệu mặt hàng có khối lượng lớn hơn 6kg, ta có công thức như sau: =COUNTIF(C2:C8,”>6″) rồi nhấn Enter.
Bạn cũng có thể thay đổi điều kiện lọc như “>=6”, “<6”, “<=6”.
Kết quả hiển thị như sau:
Sử dụng hàm COUNTIF cho điều kiện phủ định
Ta có công thức sau: =COUNTIF(B2:B8,”<>Dưa hấu”) rồi nhấn Enter để lọc dữ liệu không phải là “Dưa hấu” trong bảng.
Sử dụng hàm COUNTIF cho dữ liệu 2 điều kiện
Ví dụ ta cần tìm kiếm số lượng mặt hàng có tên khác ô B3 là Xoài bằng cách dùng ký tự “<>” và “&” trước ô tham chiếu, với cú pháp hàm =COUNTIF(B2:B8,”<>”&B3).
Trên đây là hướng dẫn sử dụng hàm COUNTIF trong Excel một cách chi tiết nhất với ví dụ cụ thể. Hy vọng những chia sẻ của Phúc Anh sẽ giúp bạn thực hiện thành công hàm COUNTIF trong Excel nhé!