+ Reply to Thread
Results 1 to 9 of 9

Count unique instances in one column meeting multiple criteria (with OR condition)

  1. #1
    Registered User
    Join Date
    12-26-2012
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Count unique instances in one column meeting multiple criteria (with OR condition)

    I've read most posts on this forum for this topic, but still can't seem to get my formulas to work. The answer may be a pivot table, but I'd like to at least know I've tried all my options.

    OK - the spreadsheet actually has 17 columns, but I can't do any of the other calculations without being able to get this one right, so I'm only including these two for now.

    Column A - Position
    Column B - Grade

    - Count unique instances in Column A that are either "O*" or "W*" in Column B

    - Count unique instances in Column A that are "E*" in Column B

    I don't think wildcards can be used though. I can get it count unique instances (=SUM(IF(FREQUENCY(A2:A48,A2:A48)>0,1)) - but it doesn't seem to work when I try to add multiple criteria.

    I've attached the most basic example of what I'm looking for. Any help will be greatly appreciated!
    Attached Files Attached Files

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    An option could be this.
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    for uniques, use this ARRAY formula:

    Please Login or Register  to view this content.
    UPDATE:

    non-FREQUENCY, non-ARRAY formula, which can handle textual data in column A:

    Please Login or Register  to view this content.
    Last edited by icestationzbra; 12-30-2012 at 04:31 PM. Reason: another approach...
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    As it my wont I went for an overly complicated array formula:

    =SUM(INDEX(IF(ISNUMBER(FIND(LEFT(B2:B48,1),"OW")),1,0),0)*(IF(ROW(A2:A48)-1=IFERROR(MATCH(A2:A48,INDEX(IF(ISNUMBER(FIND(LEFT(B2:B48,1),"OW")),A2:A48),0),0),0),1,0)))

    Confirmed with Ctrl-Shift-Enter, naturally.

  5. #5
    Registered User
    Join Date
    12-26-2012
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    Thank you! This did work - now trying to combine it with other formulas. Will post when I have the other fields filled out (my spreadsheet is held on another network).

    Thanks again!

  6. #6
    Registered User
    Join Date
    12-26-2012
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    OK - I've attached an "updated" spreadsheet. Any help will greatly save the tax payers some $$$.

    The box to the right on the spreadsheet is what I'm filling out.

    I used the formulas you gave me Fotis (thank you!!), but of course and am having trouble combining them with what I need for the next field - "Filled".

    Out of the "Authorized" number - how many cells in Column G have text? I will use this for Vacant as well (except it will count the empty cells). does this make sense?UNIQUES.xls

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    Which are the expected results-and why- in "Filled" column?

  8. #8
    Registered User
    Join Date
    12-26-2012
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    My apologies for the long break - had to travel unexpectedly.

    The expected result for Filled is:

    Mil Off: 14
    Mil Enl: 13

    Filled: Count the unique number in Column B (Position #) that also has a name in Column G (Incumbent Name). The Mil Off (“O” or “W”) and Mil Enl (“E”) still have to counted separately.
    Note: Would it simplify things to have a “status” column (Filled, Vacant, Double)? And then use that column to complete the other formulas?

    Vacant: Count the unique number in Column B (Position #) that also has a "Blank" in Column G (Incumbent Name). The Mil Off (“O” or “W”) and Mil Enl (“E”) still have to counted separately.

    Double: Count the number of Positions in Column B that occur more than one time. Each instance of the number should be counted. The Mil Off (“O” or “W”) and Mil Enl (“E”) still have to counted separately.

  9. #9
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Count unique instances in one column meeting multiple criteria (with OR condition)

    i hope i got this submission in time to save taxpayers some money...

    see the cells highlighted in yellow for results:
    Attached Files Attached Files

+ 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