简体   繁体   中英

MS Excel count distinct where

I am using MS Excel 2013, and I am trying to run something like a Count distinct where. Here is my table

Name:
jim
james
frank
jillian
jim
john
patrick
jillian
anna
isabelle

I am trying to do a count distinct where name starts with a J, which would result in 4. Here is what I have so far.

SUMPRODUCT(1/countif([names],[names]))   --- This counts unique names

SUMPRODUCT(--(LEFT([names],1)="j"))   --- This counts all names that start with J

Im trying to find a way to combine these two together to count unique names that start with J. Thanks in advance.

I figured it out. This ended up working.

=SUMPRODUCT(IF(LEFT([names])="j",1/COUNTIF([names],[names])))

请试试:

=SUMPRODUCT((LEFT(A2:A99)="J")/COUNTIF(A2:A99,A2:A99&""))

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