简体   繁体   中英

How to count the numbers of excels in Excel, based on a criteria from another column

I have an excel spreadsheet that contains a "Customer ID" field and a "Check ID" field. I need to count the number of check id's associated with that customer id for a specific date?

## Customer ID ##  ## Check ID##  ## Check Date##

   2554               823488         04/24/2015
   2554               823489         04/24/2015
   4856               823450         04/24/2015

So Customer 2554 would have a count of 2 and Customer 4856 would have a count of 1.

If your columns are A, B and C ( 4856 in A4) try in E2 and copied down to suit:

=COUNTIFS(A:A,A2,C:C,C2)  

and replace C2 with the cell absolute reference to your "specific date".

Assuming you are using Excel 2010 or later you should be able to use the =COUNTIFS() function.

例子

You should look at SUMPRODUCT function (Excel 2003 and +) that will allow you to do such a thing !

It make the product of two arrays and then return the sum of them. So if you construct an array that give 1 if a criteria is satisfied and 0 otherwise, you will have the sum of cells that satisfy the criteria.

Example: =SUMPRODUCT( (A:A=2554)*1 ) will return 2.

https://support.office.com/en-ca/article/SUMPRODUCT-function-57a7bfa7-f74d-4ead-8c93-57f759c8f616

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM