+ Reply to Thread
Results 1 to 5 of 5

Count a number in one column only for specfic input in adjacent column

  1. #1
    Registered User
    Join Date
    10-20-2010
    Location
    London, ON
    MS-Off Ver
    Excel 2003
    Posts
    3

    Exclamation Count a number in one column only for specfic input in adjacent column

    I am trying to count the number of times a certain number appears in a column, lets say A1:A100, but I only want it to be counted if the corresponding entry on the same row, but in the column next to it, lets say from B1:100, equals a certain input. I am inputting all my data is Sheet 1, but I want to include all my analysis on Sheet 2. So this analysis will be on Sheet 2 referring to Sheet 1.

    So for example, I want to count how many times the number 1 appears in range A1:A100, but only if in the same row in the range B1:B100 the input on that row is x.

    Example:
    A B
    x 1
    x 0
    y 1
    y 0

    So I would want it to show me that for the input x, the number 1 only appears once in column B.

    Is there any way to do this exact same thing, but instead of only counting the number of times a number appears in the range A1:A100, it would find the average and median of those numbers, but only if the correspond to a certain input. So using the same example, I would like it to tell me the average of the numbers in column B, but only for input x (so the average of 1 and 0 in this case would be 0.5)

    I am totally stuck on this as I haven't ever done anything this complicated. I would greatly, greatly, greatly appreciate your help. Thank you :-)

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,712

    Re: Count a number in one column only for specfic input in adjacent column

    Quote Originally Posted by brichacek View Post
    So for example, I want to count how many times the number 1 appears in range A1:A100, but only if in the same row in the range B1:B100 the input on that row is x.
    Your example shows the columns the other way round but either way the principle is the same. For multi-conditional counting in Excel 2003 try SUMPRODUCT, e.g.

    =SUMPRODUCT((A1:A100=1)*(B1:B100="x"))

    Note that typically text criteria are shown in quotes but numbers without....
    Audere est facere

  3. #3
    Registered User
    Join Date
    10-20-2010
    Location
    London, ON
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Count a number in one column only for specfic input in adjacent column

    Hmmm, I've tried that but for whatever reason I can't get it to work using this function (In sheet "RP Analysis" under the heading "Terrible (1):
    =SUMPRODUCT((Data!D11:D19="rp")*(Data!F11:F19=1))

    I'm basically trying to see for each procedure how many of each response I have to each question. Then I also want to calculate the average score given for each individual procedure, the analysis of which I will each put in a separate sheet

    Any advice? And thank you so much for your help
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count a number in one column only for specfic input in adjacent column

    It would seem that the values in Column F on Data are numbers stored as Text - so the number 1 is not found... you should therefore search for "1" rather than 1.

  5. #5
    Registered User
    Join Date
    10-20-2010
    Location
    London, ON
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Count a number in one column only for specfic input in adjacent column

    Ah, good catch, didn't even think about that, thank you!

    Does anyone have any idea on how I can do an average or a median of these select values based on the input?

+ 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