+ Reply to Thread
Results 1 to 5 of 5

Count one column when a 2nd column matches values in a 3rd column.

  1. #1
    Registered User
    Join Date
    04-04-2017
    Location
    Horgen, Switzerland
    MS-Off Ver
    2016
    Posts
    3

    Count one column when a 2nd column matches values in a 3rd column.

    I have an issue which I think countif works for but I cannot figure it out:

    One one spreadsheet I have two columns:
    Site # Active or Placebo
    15 a
    15 p
    18
    16
    24 p
    17 a
    18 a
    16 p
    17 a
    18 p
    25 a
    13
    12 p
    22 a
    22 a
    15 a
    19 a
    16 p
    13 a
    20 a
    15 p

    On a second spreadsheet I have a column matching "Site#" above (same site numbers).

    I want to count the number of non blank cells in the "Active or Placebo" column on the first spreadsheet that have site numbers in the "Site #" column that correspond with the same site number on the 2nd sheet -

    So my second sheet would look like:

    Site # # Subjects
    15 4
    16 0
    17 2
    etc.

    I have tried countif and it does not seem to have enough variables. Sumif doesnt seem to work either or I am not applying it correctly. Any help would be appreciated.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Count one column when a 2nd column matches values in a 3rd column.

    Your calculation for 16 is incorrect!

    With your list on sheet 1 starting at A2 and the same on sheet 2, try this:

    =COUNTIFS(Sheet1!$A$2:$A$22,A2,Sheet1!$B$2:$B$22,"a")+COUNTIFS(Sheet1!$A$2:$A$22,A2,Sheet1!$B$2:$B$22,"p")
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    04-04-2017
    Location
    Horgen, Switzerland
    MS-Off Ver
    2016
    Posts
    3

    Re: Count one column when a 2nd column matches values in a 3rd column.

    Thanks for your help that worked great!!!

  4. #4
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Count one column when a 2nd column matches values in a 3rd column.

    Try with below. In sheet2 "A2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Array formula : SHIFT+CTRL+ENTER
    In sheet2 "B2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Base on sheet1 data in "A" & "B" column.
    copy paste down.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Count one column when a 2nd column matches values in a 3rd column.

    You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 4
    Last Post: 10-30-2015, 07:59 AM
  2. [SOLVED] Count values in column, paste current year in another column that many times
    By johnstevens in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-05-2014, 02:32 PM
  3. Replies: 8
    Last Post: 05-15-2013, 04:50 PM
  4. [SOLVED] Macro to count unique values in a column, enter it in next column, then delete duplicates
    By pmorisse in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2013, 03:27 PM
  5. Hard? SUM the values of a column that matches a flag in an adjacent column
    By Nokao in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-07-2012, 11:29 AM
  6. Replies: 4
    Last Post: 02-18-2009, 12:13 PM
  7. Replies: 16
    Last Post: 02-09-2009, 07:29 AM

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