+ Reply to Thread
Results 1 to 8 of 8

Counting Names in one column if the adjacent column contains a specific number

  1. #1
    Registered User
    Join Date
    03-12-2012
    Location
    Philadelphia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Post Counting Names in one column if the adjacent column contains a specific number

    I want to total the amount of names in one column only if the cell in the adjacent column contains a specific number. Kind of like the sumif function but for words.
    For example I'm looking for a formula that would tell me how many names contain the number "1" next to it.

    1 -> John
    1 -> Frank
    1 -> Mary
    2 -> Mr. Ed
    3 -> Tony
    1 -> Megan
    3 -> Christa
    3 -> Jacob

    The formula should result in "4" which correlates to the amount of names that have the number 1 next to it. Please help me out. Eventually I want to utilize it in a google documents spreadsheet. Is there any reason it wouldn't work in google docs but will work in Excel? I have tried using any array formula but I'm not getting the results I'm looking for.

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Counting Names in one column if the adjacent column contains a specific number

    Hello antman,

    Assume numbers are in A2:A10 & Names are in B2:B10,

    =SUMPRODUCT((A2:A10=1)*(B2:B10<>""))
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Registered User
    Join Date
    03-12-2012
    Location
    Philadelphia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting Names in one column if the adjacent column contains a specific number

    Thanks, it works great in Excel but for some reason not in google documents. I'm assuming google docs' spreadsheet isn't as intelligent as Excel is, is there a "dumber" formula I can use instead?

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Counting Names in one column if the adjacent column contains a specific number

    Not sure about google document, try this

    =ARRAYFORMULA(SUMPRODUCT((A2:A10=1)*(B2:B10<>"")))

  5. #5
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Counting Names in one column if the adjacent column contains a specific number

    isn't the countif not working with that
    assume numbers are in Column A
    = countif(A1:A10, 1)

    if the name do not have number it will not be count, right?, and if there is no name there is no number??
    so we do not actually need to use the column of names for the countif..
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  6. #6
    Registered User
    Join Date
    03-12-2012
    Location
    Philadelphia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting Names in one column if the adjacent column contains a specific number

    vlady, you're correct that the countif would work perfectly for this, but I only posted part my spread sheet. I have additional columns with names too, but won't necessarily be the same amount as the first column of names.

    Invitee->Spouse
    1 -> John -> Sally
    1 -> Frank -> Patty
    1 -> Mary
    2 -> Mr. Ed -> Lois
    3 -> Tony -> Joyce
    1 -> Megan -> Bill
    3 -> Christa -> Matt
    3 -> Jacob

    So I want to total the amount of invitees separate from the amount of spouses that have a 1 at the beginning of each row.
    Invitees with 1 = "4"
    Spouses with 1 = "3"

  7. #7
    Registered User
    Join Date
    03-12-2012
    Location
    Philadelphia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting Names in one column if the adjacent column contains a specific number

    Quote Originally Posted by Haseeb A View Post
    Not sure about google document, try this

    =ARRAYFORMULA(SUMPRODUCT((A2:A10=1)*(B2:B10<>"")))
    Still no luck. However instead of #value error message it returns a zero. Could be getting somewhere...

  8. #8
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Counting Names in one column if the adjacent column contains a specific number

    numbers in A names in B have to use cell refference for number 1 , 2, 3 as per your example

    =arrayformula(SUM(IF(A1:A9=1 or this be cell reff $A$1 ,IF(B1:B9<>"",1,0),0)))

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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