+ Reply to Thread
Results 1 to 4 of 4

Thread: Count items in column B if column c meets criteria

  1. #1
    Registered User
    Join Date
    01-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Count items in column B if column c meets criteria

    Hi all,

    I wanted some help to count the unique values in column B if Column C of my table holds a specific value.
    I am trying the formula:

    =SUM(IF(FREQUENCY(IF(Table_TAWData[Col Name2]="Criteria",IF(Table_TAWData[Col Name1]<>"",MATCH(Table_TAWData[Col Name 1],Table_TAWData[Col Name 1],0))),ROW(Table_TAWData[Col Name 1])-ROW('T@WData'!C2)+1),1))

    I hit ctrl+shift+enter but it doesnt seem to work. Is it because I am not using a set range?

    Lets say the data looks like:

    Col Name 1 Col Name 2
    A Criteria
    B Criteria
    A Criteria
    D Not Criteria
    A Criteria
    C Not Criteria

    I want it to return 2.

    can someone help me please?

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Count items in column B if column c meets criteria

    Maybe attaching a small sample file with the same table structure would help so we can see if you are using the right convention....

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook. Don't upload a picture when you have a workbook question. None of us is inclined to recreate your data. Upload the workbook and manually add an 'after' situation so that we can see what you expect. In addition clearly explain how you get the results..
    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'.
    To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'.
    Clicking this button will open a new window for uploading attachments.

    You can upload an attachment either from your computer or from another URL by using the appropriate box on this page.
    Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file.

    To upload a file from another URL, enter the full URL for the file in the second box on this page.
    Once you have completed one of the boxes, click 'Upload'.

    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.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    01-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Count items in column B if column c meets criteria

    Attached is an example file and what I am trying to achieve.
    I would like to use only formulae and arrive at the figures in column I.
    Attached Files Attached Files

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Count items in column B if column c meets criteria

    For the sample your provided these are the formulas in I1:I4, respectively...

    =SUM(IF(FREQUENCY(IF($E$2:$E$12="Dog",IF($D$2:$D$12<>"",MATCH($D$2:$D$12,$D$2:$D$12,0))),ROW($D$2:$D$12)-ROW($D$2)+1),1))
    =SUM(IF(FREQUENCY(IF($E$2:$E$12="Cat",IF($D$2:$D$12<>"",MATCH($D$2:$D$12,$D$2:$D$12,0))),ROW($D$2:$D$12)-ROW($D$2)+1),1))
    =SUM(IF(FREQUENCY(IF(($E$2:$E$12="Dog")*($A$2:$A$12="1920s"),IF($D$2:$D$12<>"",MATCH($D$2:$D$12,$D$2:$D$12,0))),ROW($D$2:$D$12)-ROW($D$2)+1),1))
    =SUM(IF(FREQUENCY(IF(($E$2:$E$12="Cat")*($A$2:$A$12="1940s"),IF($D$2:$D$12<>"",MATCH($D$2:$D$12,$D$2:$D$12,0))),ROW($D$2:$D$12)-ROW($D$2)+1),1))
    You can sub the criteria with cell references.

    Each formula must be confirmed with CTRL+SHIFT+ENTER not just ENTER.

    Note: There was a misspelled word Siamese in cell D5... which would skew the actual expected results...
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ 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.2.0