+ Reply to Thread
Results 1 to 6 of 6

How to count different values which also meet conditions

  1. #1
    Registered User
    Join Date
    07-10-2017
    Location
    madrid
    MS-Off Ver
    2010
    Posts
    7

    How to count different values which also meet conditions

    Hi everyone,

    I have this problem: I need to count how many different values are there within a column which meet certain conditions. I have the extra difficulty of refering data from a different workbook while it's closed, so I can't use Countifs nor Sumifs, only the Sumproduct workaround. I can't attach a sample file (I don't know why), but it's something like this. Let´s assume I'm a car dealer and I want to know how many different colors I have for cars from year 2015 :

    CAR REF YEAR COLOR

    001 2015 Red
    002 2016 Blue
    003 2014 Green
    004 2015 Red
    005 2015 Blue
    006 2016 Red
    007 2014 Green

    The answer is obviously 2 in this case, but you get the idea. Any help would be really appreciated.

    Regards.

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: How to count different values which also meet conditions

    might help:

    https://exceljet.net/formula/count-u...-with-criteria
    Please do add reputation where you see fit, it's nice to be nice and we all enjoy a pat on the back

    Please also mark your thread as solved once it has been.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,227

    Re: How to count different values which also meet conditions

    I can't attach a sample file (I don't know why), ...
    I do!

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    07-10-2017
    Location
    madrid
    MS-Off Ver
    2010
    Posts
    7

    Re: How to count different values which also meet conditions

    Quote Originally Posted by PFDave View Post
    I'm going to try that, thanks!

    Quote Originally Posted by AliGW View Post
    I do!

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    I understand, thanks!

  5. #5
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2503 Build 16.0.18604.20000) 64-bit
    Posts
    3,999

    Re: How to count different values which also meet conditions

    Row\Col
    A
    B
    C
    D
    E
    F
    1
    CAR YEAR COLOR
    2
    1
    2015
    Red
    3
    2
    2016
    Blue
    4
    3
    2014
    Green
    5
    4
    2015
    Red
    6
    5
    2015
    Blue
    7
    6
    2016
    Red
    8
    7
    2014
    Green
    9
    Formula {=SUM(--(FREQUENCY(IF(B2:B8>=2015,MATCH(C2:C8,C2:C8,0)),ROW(C2:C8)-ROW(C1))>0))}
    10
    Result
    2


    Try

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  6. #6
    Registered User
    Join Date
    07-10-2017
    Location
    madrid
    MS-Off Ver
    2010
    Posts
    7

    Re: How to count different values which also meet conditions

    It worked, thanks to you all!! Now I discovered a quite worse difficulty for my task, but I'll open a new thread for that as the forum's rules state.

+ 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 unique values across sheets in a workbook that meet certain conditions
    By libramom814 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-29-2016, 08:41 AM
  2. How to count unique values in two ranges that meet conditions
    By akbermo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-18-2015, 08:22 AM
  3. Count number of contiguous values in a range which meet conditions
    By LAUGHINGCROW in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 09-15-2014, 09:25 AM
  4. Count number of rows that meet two conditions
    By travisg in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-18-2013, 12:20 PM
  5. Count # of rows that meet one of two conditions?
    By MrZ113 in forum Excel General
    Replies: 3
    Last Post: 02-21-2011, 11:23 AM
  6. Count matches that meet 2 conditions.
    By frankd in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-04-2010, 04:49 PM
  7. Count rows that meet 3 or more conditions
    By bigwmf in forum Excel General
    Replies: 3
    Last Post: 11-15-2006, 05:56 PM

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