+ Reply to Thread
Results 1 to 5 of 5

CountIf - calculate how many times the name has been listed

  1. #1
    Registered User
    Join Date
    04-19-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    21

    CountIf - calculate how many times the name has been listed

    Hi, I'm having problems with something that should be a simple task.
    I have a column of names and I need to calculate how many times the name has been listed (not find and remove or anything like that). Right now my sheet looks something like this:

    James James 1
    Bob Bob 1
    Terry
    Terry
    Steve
    Terry
    Steve
    Steve
    Chris
    Terry Terry 4
    Chris
    Mary Mary 1
    Arnold Arnold 1
    Steve
    Chris Chris 3
    Steve Steve 5

    Using the formula:
    =IF(COUNTIF(A1:$A$2,A1)=COUNTIF(A:A,A1),A1&" "&COUNTIF(A:A,A1)," ")

    This is almost perfect except that I only want the name listed in the second column if it is listed 2 or more times. Most of the time in my actual spreadsheet a person will only be listed once. So because of that, I really need to highlight the people who are in the list 2 or more times.

    Also, I'd like to use conditional formatting to colour the cell with the Name and # of times it was listed. This is sort of a secondary problem though and I'm not AS concerned about it.

    I've looked through the forum and have found similar problems and have pieced together what I have but just need to figure out this last part.

    Thanks, hope you are able to help!
    Attached Files Attached Files
    Last edited by VBA Noob; 04-19-2009 at 05:46 PM.

  2. #2
    Registered User
    Join Date
    01-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    67

    Re: CountIf - calculate how many times the name has been listed

    Try in B1:
    =IF(AND(COUNTIF(A:A,A1)>1,COUNTIF(A1:$A$1,A1)=COUNTIF(A:A,A1)),A1&" "&COUNTIF(A:A,A1),"")
    and copy down

    and for conditional formatting, select the used range of column B and try this formula:
    =B1<>""

    to highlight the names in the list (column A), try this formula in conditional format:
    =COUNTIF(A:A,A1)>1
    Last edited by c_m; 04-19-2009 at 06:06 PM.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: CountIf - calculate how many times the name has been listed

    You could use this formula in B1 copied down

    =IF(AND(COUNTIF(A$1:A1,A1)>1,COUNTIF(A$1:A1,A1)=COUNTIF(A:A,A1)),A1&" "&COUNTIF(A:A,A1)," ")

  4. #4
    Registered User
    Join Date
    04-19-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: CountIf - calculate how many times the name has been listed

    That's great! Thanks a lot for the quick response too. Any suggestions on how to colour those cells? If not, then the formula you gave me will work fine on its own.

    I didn't think there was a way to do that. Thanks again!

  5. #5
    Registered User
    Join Date
    04-19-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: CountIf - calculate how many times the name has been listed

    Oops, sorry C_M. I didn't even see your post for some reason. Thanks, the conditional formatting worked like a peach!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1