Solved

excel count formula

Posted on 2014-03-27
10
413 Views
Last Modified: 2014-04-02
without using pivot tables, is there any way (in column B, where column A is my column full of usernames), to write a formula to count how many times a specific name appears, or perhaps do this formula on a seperate sheet if not possible on the same sheet.

So if user1 appears 35 times in column A I need a summary saying user1 - 35
0
Comment
Question by:pma111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 18

Accepted Solution

by:
Steven Harris earned 125 total points
ID: 39958940
You can use a simple COUNTIF:

If Column A contains the following:
John
Jane
Samson
John
Carl
John
Samson
Jane
Jane
Billy

In Column B you could count the occurrence of "Jane" suing the following:

=COUNTIF(range,"Jane")

range would be the range you want to sample from Column A, such as A1:A10:

=COUNTIF(A1:A10,"Jane")

Using the data above, the resulting value would be 3.

You can also substitute a cell reference in place of "Jane":

=COUNTIF(A1:A10,A3)

In the above example, this would look for the value "Samson" and return the value 2.
0
 
LVL 19

Assisted Solution

by:Raheman M. Abdul
Raheman M. Abdul earned 125 total points
ID: 39958949
A1 has your data
then
in B1 type this formula:
=SUM(LEN(A1)-LEN(SUBSTITUTE(A1,"abdul","")))/LEN("abdul")
0
 
LVL 39

Assisted Solution

by:nutsch
nutsch earned 125 total points
ID: 39958963
With the countif formula, one quick way I'm doing it is to copy the column with the names to a different non-adjacent column, run Data \ Remove Duplicates to only get single values, then use the countif there. So if your original column is in A with 50 rows, your new, no-duplicates, set is in column E, use in cell F2

=countif($A$1:$A$50,e2)

But I'd probably still use a pivot.

Thomas
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 3

Author Comment

by:pma111
ID: 39958962
WHat about if you dont have a unique list of usernames, and didnt want to do each manually, or would you filter for those (a unique list) first to use as a lookup table to get the statistics?
0
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39958967
A1 has your data
B1 has the name you want to find
C1  =SUM(LEN(A1)-LEN(SUBSTITUTE(A1,B1,"")))/LEN(B1)
0
 
LVL 3

Author Comment

by:pma111
ID: 39958971
That answered it, will give this a go.
0
 
LVL 33

Assisted Solution

by:Rob Henson
Rob Henson earned 125 total points
ID: 39959341
If the list of user names is in order, you can do a check between consecutive cells and only puta count against the first or last occurence of a name.

If they are not in order, you can still do similar but it would have to be against the first occurence.

Assuming your user names in column A2 to A65 with header in row 1:

=IF(COUNTIF($A$1:$A1,$A2)>0,"",COUNTIF($A$1:$A$65,A2))

This counts if the name in A2 has already been counted in previous rows and if so returns blank, otherwise counts occurences in the whole column. Note use of $ for locking top of column for first count but whole range for second count.

Thanks
Rob H
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 39959351
If data is in order, put count against first occurence:

=IF($A2=$A1,"",COUNTIF($A$1:$A$65,$A2))

put count against last occurence:

=IF($A2=$A3,"",COUNTIF($A$1:$A$65,$A2))

Thanks
Rob H
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 39959366
Data out of order and count against last occurence:

=IF(COUNTIF($A$66:$A66,$A65)>0,"",COUNTIF($A$1:$A$65,$A65))

Note reference to row 66 when data stops at row 65.

Thanks
Rob H
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 39969002
Alternative using a summary on another sheet as suggested in question.

Assuming names in column A of Sheet1, this will give a list of unique entries:

=INDEX(Sheet1!$A$1:$A$98,SMALL(IF(Sheet1!$A$1:$A$98="",ROWS(Sheet1!$A$1:$A$98),IF(MATCH(Sheet1!$A$1:$A$98,Sheet1!$A$1:$A$98,0)=ROW(Sheet1!$A$1:$A$98),ROW(Sheet1!$A$1:$A$98),ROWS(Sheet1!$A$1:$A$98))),ROW()))

Confirm with Shift + Ctrl + Enter and {...} brackets will appear at each end, converting to an array formula.

Alongside this you can then just do a normal COUNTIF function, in B1 of Sheet2, when start of list created above is in A1:

=COUNTIF(Sheet1!A:A,A1)

Copy down the extent of the list.

By the way, why do you not want to use a Pivot??

Thanks
Rob H
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question