[Excel] How to Count Data from Another Sheet Using COUNTIF

目次

Background

When working in Excel, you often want to aggregate data that is split across multiple sheets. In my case, I had raw data in Sheet2 and wanted to summarize it in Sheet1. However, counting manually how many times a specific text string appeared was tedious, so I investigated whether I could automate this using Excel functions.

Solution: Use the COUNTIF Function

The conclusion is that by using the COUNTIF function, you can easily count data even if it resides on a different sheet.

Basic Syntax

=COUNTIF(range, criteria)

Function Actually Used

Here is an example of counting how many times the string in cell A1 of Sheet1 appears in Column B of Sheet2.

=COUNTIF('Sheet2'!B:B, 'Sheet1'!A1)

How this formula works:

  • Range: 'Sheet2'!B:B → Refers to the entire Column B of Sheet2.
  • Criteria: 'Sheet1'!A1 → Refers to the content of cell A1 in Sheet1 (the string you want to count).

By entering this formula into, for example, cell B3 of Sheet1, you can automatically display how many records in Sheet2 match the string in A1.

Application Tips

  • Counting Specific Numbers: You can use it the same way for specific numbers (e.g., =COUNTIF('Sheet2'!A:A, 100)).
  • Multiple Conditions: If you want to count based on multiple criteria (e.g., “Date is X” AND “Item is Y”), using the COUNTIFS function allows for more flexibility.
  • Batch Aggregation: If you have multiple strings you want to count, list them in Column A and drag the COUNTIF formula down in Column B to summarize them all at once.

Summary

  • The COUNTIF function makes it possible to easily count data on different sheets.
  • The key point is correctly specifying the Range (including the sheet name) and the Criteria.
  • This is an extremely useful function for aggregation tasks and data analysis.

Just automating the parts you used to count manually can significantly improve your work efficiency. Thank you for reading.


よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

私が勉強したこと、実践したこと、してることを書いているブログです。
主に資産運用について書いていたのですが、
最近はプログラミングに興味があるので、今はそればっかりです。

目次