+ Reply to Thread
Results 1 to 17 of 17

Count IF (match category)

  1. #1
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Count IF (match category)

    Hi guys, probably a very simple for you, challenging here as not able to crack the Match or Index ways yet...

    Its as per image and Excel attached - what do we enter to make numbers count based on category match?

    Basically, a formula should look into Column S, and if it finds a matching category in column B, it should make a count.

    Based on given examples, Personal Hobbies should return 8 (and if formula works then it should count well for rest of categories)

    ALSO - just in case its a complicated formula, can we please include IFERROR, to return 0 if cells are blank? Thanking for all of your help!

    https://www.excelforum.com/attachmen...1&d=1509030318
    Attached Images Attached Images
    Last edited by AliGW; 10-26-2017 at 12:06 PM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Count IF (match category)

    Unable to open attachment

    "Invalid Attachment specified. If you followed a valid link, please notify the administrator"
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,366

    Re: Count IF (match category)

    What are your expected outcomes in this table?

    Excel 2016 (Windows) 32 bit
    S
    T
    U
    V
    40
    CATEGORY COUNT
    41
    Personal hobbies
    42
    Adventure & outdoors
    43
    Cinema/theater/plays
    44
    Movies/music/games
    45
    Explore places & events
    46
    Leisure, social & dining
    47
    Pleasure/fun/relax
    48
    Fashion shopping
    49
    Flights & travel
    50
    Sports & active
    51
    Toys & gadgets
    52
    Special vacation
    Sheet: Celebrate
    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.

  4. #4
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,366

    Re: Count IF (match category)

    The link is working fine here.

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count IF (match category)

    The link is not working for me.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

    After you upload an actual Excel workbook, please explain why Personal hobbies should return 8. From the picture, I only see one cell in the Personal hobbies row with something in it.

  6. #6
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,366

    Re: Count IF (match category)

    Based on given examples, Personal Hobbies should return 8 ...
    Why is that? Explain, please.

  7. #7
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Count IF (match category)

    Link still notr working for me

  8. #8
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,366

    Re: Count IF (match category)

    See the attached, which I downloaded.
    Attached Files Attached Files

  9. #9
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count IF (match category)

    Thanks Ali.

    Try this in V41:
    =SUMPRODUCT((B$30:B$56=S41)*(D$30:O$56<>"")*(D$57:O$57))

    Also, you can shorten the formula in D57 to this:
    =SUM(COUNTIF(D30:D56, {"y","x"}))

  10. #10
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Count IF (match category)

    @vill: Are you looking for x's, y's or both?

  11. #11
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Re: Count IF (match category)

    Sorry guys, was rushed away from a desk.

    Don't know why would a file wouldn't load for some of you either... first time it happened!

    Apologies if confused anyone with task description, but in it's simplicity all that a formula needs to do is:

    1. Look at categories in S Column (one category at a time)
    2. Return a number that category was mentioned in Column B (B5:B56)

    So if to count 'Personal hobbies' manually, in Column B it was mentioned 8 times (B5,B6,B8,B9,B11,B14,B15,B48)

    We not counting "y" or "x" anywhere here, never asked or mentioned about it... I kept original copy with all there is just in case some complicated formula would be used and I would not be able to then replicate it in the original copy...

  12. #12
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Re: Count IF (match category)

    And thanks for =SUM(COUNTIF(D30:D56, {"y","x"})) @63falcondude !! Much neater approach, love it

  13. #13
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count IF (match category)

    You're welcome. Did the suggested formula for V41 (from post #9) do what you were looking for?



    Also, upon further review, you are using Data Validation to force the user to enter x or y, so this:

    =SUM(COUNTIF(D30:D56, {"y","x"}))

    can be made even shorter to this:

    =COUNTA(D30:D56)

  14. #14
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Re: Count IF (match category)

    Thanks for another tip!

    No, the suggested for V41 is not the one... it counts the x and y from D30:O56 and all is needed here, as per post #11:

    1. Look at categories in S Column (one category at a time)
    2. Return a number that category was mentioned in Column B (B5:B56)

    So if to count 'Personal hobbies' manually, in Column B it was mentioned 8 times (B5,B6,B8,B9,B11,B14,B15,B48)

    We not counting "y" or "x" anywhere here, never asked or mentioned about it... I kept original copy with all there is just in case some complicated formula would be used and I would not be able to then replicate it in the original copy...


    Am I confusing somewhere?

  15. #15
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count IF (match category)

    In that case, this should suffice:

    V41 =COUNTIF(B$5:B$56,S41)

  16. #16
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Re: Count IF (match category)

    Wha? No Match, no Index, just like that? Blew me away, 63falcondude! Totally... jeez...

    Thank you sooo much for this! What can I say...

    Thank you...

  17. #17
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count IF (match category)

    Happy to help. Thanks for the rep!

+ 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. Count category as per highest number count
    By arindamsenaxa in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-03-2017, 01:13 AM
  2. [SOLVED] Count of occurrences by category
    By dmullin13 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-24-2015, 01:05 PM
  3. [SOLVED] Count items of only one category
    By nooredein in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 05-06-2014, 04:18 PM
  4. Match two category
    By suhabthan in forum Excel General
    Replies: 11
    Last Post: 05-09-2012, 06:50 PM
  5. Count by Category
    By bronkista in forum Excel General
    Replies: 1
    Last Post: 08-04-2011, 06:29 PM
  6. How to Count for each category
    By afriedman in forum Excel General
    Replies: 10
    Last Post: 06-21-2011, 05:33 PM
  7. Count by Category and insert new row
    By karinos57 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2009, 01:41 PM

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