+ Reply to Thread
Results 1 to 18 of 18

Help! Counting First and Last Names

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    7

    Help! Counting First and Last Names

    Hi, I have a file I'm working on for a physiotherapist. It lists all patient appointments and she wants to be able to count how many appointments a particular patient has had. I have been trying to use the COUNTIF formulas to say if First name = X and last name = y to count how many instances they appear (this needs to be done as some have the same first names or surnames).

    E.g

    Joe Blogs
    Fred Mcfarlan
    Billy Friday
    Billy Friday
    Billy Friday
    Billy Tuesday
    Billy Tuesday

    So I want to count how many times Billy Friday has had appointments with me, what formula would I use to get that data?

    Any help would be much appreciated!

    Carolyn

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help! Counting First and Last Names

    Try countifS

    =COUNTIFS(A1:A100,"Billy",B1:B100,"Friday")

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Help! Counting First and Last Names

    Try this one

    =COUNTIFS(A2:A7,"Billy",B2:B7,"Friday")

    A
    B
    C
    1
    Joe Blogs
    3
    2
    Fred Mcfarlan
    3
    Billy Friday
    4
    Billy Friday
    5
    Billy Friday
    6
    Billy Tuesday
    7
    Billy Tuesday
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Help! Counting First and Last Names

    You want the COUNTIFs formula which allows for multiple criteria (as in look for first name then look for last name and count all that match).

    See the attached.

    CountIFS.xlsx
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  5. #5
    Registered User
    Join Date
    04-14-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Help! Counting First and Last Names

    Quote Originally Posted by Carolyn Phillips View Post
    Hi, I have a file I'm working on for a physiotherapist. It lists all patient appointments and she wants to be able to count how many appointments a particular patient has had. I have been trying to use the COUNTIF formulas to say if First name = X and last name = y to count how many instances they appear (this needs to be done as some have the same first names or surnames).

    E.g

    Joe Blogs
    Fred Mcfarlan
    Billy Friday
    Billy Friday
    Billy Friday
    Billy Tuesday
    Billy Tuesday

    So I want to count how many times Billy Friday has had appointments with me, what formula would I use to get that data?

    Any help would be much appreciated!

    Carolyn
    So I did that example and it works, then I try to replicate it on the live data and it's coming back with a 0 - why does it do that?

  6. #6
    Registered User
    Join Date
    04-14-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Help! Counting First and Last Names

    I did the example, it worked, I then replicated it on the live data and its coming back with a 0 - I don't understand why it's not working!

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help! Counting First and Last Names

    It would return 0 if none of the rows met the criteria.
    Check for exact spelling, and extra spaces in the cells.. "Billy" vs " Billy" vs "Billy "

    Can you post a sample workbook?

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help! Counting First and Last Names

    To post a workbook, Go Advanced>Manage Attachments (or click on paperclip icon)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  9. #9
    Registered User
    Join Date
    04-14-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Help! Counting First and Last Names

    Here you go - not used this forum before, so hopefully it will attach!
    Attached Files Attached Files

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Help! Counting First and Last Names

    Try this now. You have trailing spaces in column A

    =COUNTIFS(A1:A6,"Jean*",B1:B6,"Doe")

  11. #11
    Registered User
    Join Date
    04-14-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Help! Counting First and Last Names

    Wow - thank you. Something so silly as a space can really muck those formulas up. Now for my next question - how do I easily pull that formula down to make the same formula work for a certain set of patients without having to update all the names manually in the list?

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,936

    Re: Help! Counting First and Last Names

    Carolyn - you need to refer the formulae to two cells where you can input the names.

    =COUNTIFS(A1:A6,E1&"*",B1:B6,E2) where E1 is the cell into which you type the first name and E2 the last name.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  13. #13
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Help! Counting First and Last Names

    You would have to create a table with names so you could reference them in your formula instead of hard-coded values.

    Something like this

    =COUNTIFS($A$1:$A$6,D1,$B$1:$B$6,E1)

    A
    B
    C
    D
    E
    1
    Jean Doe
    2
    Jean Doe
    2
    Lyn Farley
    2
    Lyn Farley
    3
    Herbert Organza
    1
    Herbert Organza
    4
    Lyn Farley
    1
    Phil Grover
    5
    Phil Grover
    6
    Jean Doe

  14. #14
    Registered User
    Join Date
    04-14-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Help! Counting First and Last Names

    Thanks, it worked!

  15. #15
    Registered User
    Join Date
    04-14-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Help! Counting First and Last Names

    Now for my next question. I now want to add up revenue by customer, so I have my customer database to reference the name, and my appointments with income. So my query is: if first name = jean and second name = pitney in appointments then add up the income next to their names...

    Customer Database
    Jean Pitney

    Appointments

    Jean Pitney £25
    Jean Pitney £45
    Jean Pitney £85
    Jean Pitney £105
    Harold Organza £145
    Last edited by Carolyn Phillips; 04-14-2014 at 12:59 PM. Reason: Formatting issue

  16. #16
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Help! Counting First and Last Names

    You're welcome. Please don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

  17. #17
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help! Counting First and Last Names

    Now you want the SUMIFS function

    =SUMIFS(SUMRANGE (i.e. C1:C12), range 1, criteria 1, range 2, criteria 2)

  18. #18
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Help! Counting First and Last Names

    Why not build a pivot table and use the native filter functionality to count occurrences?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Counting names in a column but counting duplicate names once
    By TBoe in forum Excel General
    Replies: 10
    Last Post: 01-04-2014, 12:12 AM
  2. Counting Unique names
    By dloconto in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-26-2013, 10:28 PM
  3. Counting up names
    By Cmorgan in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 03-19-2012, 04:18 AM
  4. Counting Names
    By snoopdilla in forum Excel General
    Replies: 7
    Last Post: 03-11-2011, 01:41 PM
  5. Counting colours and names
    By knickolyed in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-16-2008, 09:11 AM

Tags for this Thread

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