+ Reply to Thread
Results 1 to 7 of 7

Marking Distinct Values in Table based on multiple conditions

  1. #1
    Registered User
    Join Date
    07-02-2013
    Location
    Pakistan
    MS-Off Ver
    Excel 365
    Posts
    51

    Question Marking Distinct Values in Table based on multiple conditions

    Dear All,

    I am looking for a formula in a long datasets (Excel table) to identify Distinct Values based on multiple conditions.
    For Example:
    When Type = ONE, Year = 2019 so it should count that District and return 1 and skip the rest values in that year

    In past sheets, I have been using COUNTIFS but it is not accurately working here modified for this reason as below
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    If you see in below picture so for 2020 it is working but in 2019 column its showing for 2020 as well (marked as red)

    Excel.jpg

    Please draft me an alternate or correction in above to get the desired results
    Attached Files Attached Files
    Last edited by naveeddil; 11-28-2020 at 03:41 PM.

  2. #2
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Marking Distinct Values in Table based on multiple conditions

    Try this:

    =IF(AND(COUNTIFS($A$3:$A3,"ONE",$B$3:$B3,2019,$C$3:$C3,C3)=1,B3=2019),1,"")
    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.

  3. #3
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,420

    Re: Marking Distinct Values in Table based on multiple conditions

    Multi-conditional formatting formula

    HTML Code: 
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Marking Distinct Values in Table based on multiple conditions

    Or with a pivot table
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-02-2013
    Location
    Pakistan
    MS-Off Ver
    Excel 365
    Posts
    51

    Re: Marking Distinct Values in Table based on multiple conditions

    Quote Originally Posted by AliGW View Post
    Try this:

    =IF(AND(COUNTIFS($A$3:$A3,"ONE",$B$3:$B3,2019,$C$3:$C3,C3)=1,B3=2019),1,"")
    Worked Perfectly as i am trying to do it via Formula:-)


    I can do it via Pivot table and conditional formatting but that wont solve my requirement

  6. #6
    Registered User
    Join Date
    07-02-2013
    Location
    Pakistan
    MS-Off Ver
    Excel 365
    Posts
    51

    Re: Marking Distinct Values in Table based on multiple conditions

    Dear All,

    This need some work now as I found that when there is single value for the year so it pick it otherwise it wont.. See below Screenshot as 2020 is only one district so it is picking as 1 but 2019 is all blank with same formula.

    What i want is that one district, One type and one year should return me value as 1 and rest repeating district in those categories should be blank.

    For 2019:
    Please Login or Register  to view this content.
    For 2020 same formula:
    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by naveeddil; 01-28-2021 at 12:00 AM.

  7. #7
    Registered User
    Join Date
    07-02-2013
    Location
    Pakistan
    MS-Off Ver
    Excel 365
    Posts
    51

    Re: Marking Distinct Values in Table based on multiple conditions

    I think sorted it out:
    I was giving fixed range in earlier by specifying range upto 436 rows
    =IF(AND(COUNTIFS($B$4:$B436,"WPV",$C$4:$C436,2019,$G$4:$G436,G4)=1,B4="WPV",C4=2019),1,"")

    Now left it open like below:
    =IF(AND(COUNTIFS($B$4:$B4,"WPV",$C$4:$C4,2019,$G$4:$G4,G4)=1,B4="WPV"),1,"")

+ 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. [SOLVED] COUNTIF for distinct values only for two conditions
    By JulianS96 in forum Excel Formulas & Functions
    Replies: 29
    Last Post: 02-25-2020, 07:18 AM
  2. [SOLVED] Finding and marking duplicate value based on two conditions
    By gesaugen in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-21-2016, 04:53 PM
  3. Sum column and count distinct values in another based on multiple criteria
    By mike.greene in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-12-2015, 11:50 AM
  4. Count distinct records that meet multiple conditions
    By rubthebuddha in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2013, 09:54 AM
  5. Replies: 1
    Last Post: 10-01-2013, 02:41 AM
  6. Insert multiple values from seperate table based on multiple conditions
    By drakesong in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-28-2011, 06:04 PM
  7. [SOLVED] look up table values with multiple conditions
    By TechMGR in forum Excel General
    Replies: 3
    Last Post: 01-09-2006, 08:55 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