+ Reply to Thread
Results 1 to 10 of 10

Counting a non-number value with a condition

  1. #1
    Registered User
    Join Date
    05-05-2008
    Location
    Kentucky, for now
    Posts
    18

    Counting a non-number value with a condition

    Help,

    Here is my problem:

    In column A4:A244 I have the numbers 1,2,3 or 4

    In another column D4:D244 I have 6 different values such as, A, B, C, D, E , F that they could have chosen.

    I want to find out how many 1s in Column A chose A in column D?

    I have tried the countif function, sumproduct function but none work.

    Thanks for your help.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    =SUMPRODUCT((A4:A244=1)*(D4:D244="A"))
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    05-05-2008
    Location
    Kentucky, for now
    Posts
    18

    Thank you

    Thanks a million!

  4. #4
    Registered User
    Join Date
    05-05-2008
    Location
    Kentucky, for now
    Posts
    18

    Cool

    Here is my problem:

    In column A4:A244 I have the numbers 1,2,3 or 4

    In another column D4:D244 I have 6 different values such as, A, B, C, D, E , F that they could have chosen.

    I want to find out how many 1s in Column A chose A in column D?

    I have tried the countif function, sumproduct function but none work.
    I solved the ABOVE

    Thanks for your help.
    {=AVERAGE(IF(M64:M123<>0, M64:M123,"")}

    Now I want to do the same thing with the Above is the formula.
    Can anyone help please?

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    I'm not clear what you're asking here, how is the AVERAGE formula relevant?

    If this question isn't related to your first question you should start a new thread as per the forum rules

  6. #6
    Registered User
    Join Date
    05-05-2008
    Location
    Kentucky, for now
    Posts
    18

    Question Counting a number value

    {=AVERAGE(IF(M64:M123<>0, M64:M123,"")}

    Please look at the above formula. It is a formula where the question was asked "Was the chaplain available when you needed him?" Possible answers was -3 -2 -1 0 1 2 3.

    Here is what I want to do:

    In column A4:A244 I have the numbers 1,2,3 or 4.

    I want to use the Average formula above but only average those who are 1 or 2 or 3 or 4 from column A4:244 above. I hope this makes sense.
    Thanks
    Last edited by servant117; 05-08-2008 at 10:55 AM.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    No, sorry, I still don't get it. How does the range M64:M123 relate to the range A4:A244, One has 60 cells the other 240?

    Which cells exactly do you want to average.

    Perhaps you could give a pared down example, with expected results?

  8. #8
    Registered User
    Join Date
    05-05-2008
    Location
    Kentucky, for now
    Posts
    18

    Cool

    =SUMPRODUCT((A4:A244=1)*(D4:D244="A"))

    This above formula only counts the As in range d4:d244 from those who are 1s in a4:a244

    I want to basically do the same but I only want to average those who are 1s in column "A" who have put down values in column m where the 0 is not counted.

    {=AVERAGE(IF(M64:M123<>0, M64:M123,"")}

    I want to do the above(the person who created this above average formula simply average the cells that have a 1 in them.

    I want to make it chose the 1s from column a4:a244 and average them not counting the 0 like above.

    column a column m
    1 1
    1 -2
    1 0
    1 3
    2 3
    2 2
    2 0
    3 -1
    3 -2
    3 -3
    4 3
    4 2
    4 3

    I want to chose the 1s in column A and average thier responses in column M not counting the 0 values.
    Thanks

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Perhaps?

    =AVERAGE(IF(A64:A123=1,IF(M64:M123<>0, M64:M123,""))

    confirmed with CTRL+SHIFT+ENTER
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  10. #10
    Registered User
    Join Date
    05-05-2008
    Location
    Kentucky, for now
    Posts
    18

    Smile

    PERFECT, thanks.

+ 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