+ Reply to Thread
Results 1 to 8 of 8

Complex UNIQUE formula based on multiple criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    07-05-2022
    Location
    Phoenix
    MS-Off Ver
    365
    Posts
    2

    Complex UNIQUE formula based on multiple criteria

    On the attached sample spreadsheet you will see that I have one column with Dates and one Column with numbers.
    You will see the formula used to pull the dates and total entries.
    I want to be able to gather total UNIQUE quantities of each number under each new date, that has not been used in previous dates.

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Complex UNIQUE formula based on multiple criteria

    one option (based on your sample data / setup)

    Formula: copy to clipboard
    F2: =SUM((MATCH(UNIQUE(FILTER(B:B,A:A=D2)),B:B,0)>=MATCH(D2,A:A,0))+0)
    copied down
    this will mirror your expected results -- i.e. only count if id use, on given day, equates to first time it's used

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,903

    Re: Complex UNIQUE formula based on multiple criteria

    With Power Query's Group By Function

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"ACTUAL#(lf)DATE", type date}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"ACTUAL#(lf)DATE"}, {{"Reported Total", each Table.RowCount(_), Int64.Type}, {"Reported Unique", each Table.RowCount(Table.Distinct(_)), Int64.Type}})
    in
        #"Grouped Rows"
    Excel 2016 (Windows) 64 bit
    D
    E
    F
    16
    ACTUAL
    DATE
    Reported Total Reported Unique
    17
    6/28/2022
    4
    4
    18
    6/29/2022
    2
    2
    19
    6/30/2022
    8
    7
    20
    7/1/2022
    5
    5
    21
    7/2/2022
    4
    4
    22
    7/3/2022
    1
    1
    23
    7/4/2022
    9
    9
    Sheet: Sheet1

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    07-05-2022
    Location
    Phoenix
    MS-Off Ver
    365
    Posts
    2

    Re: Complex UNIQUE formula based on multiple criteria

    Thank you, XLent & Alansidman, that is what I was looking for. Way simpler than I was trying to make it!

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,903

    Re: Complex UNIQUE formula based on multiple criteria

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  6. #6
    Forum Contributor John Vergara's Avatar
    Join Date
    01-17-2022
    Location
    Colombia
    MS-Off Ver
    365
    Posts
    210

    Re: Complex UNIQUE formula based on multiple criteria

    Hi to all!

    Another option could be:
    PHP Code: 
    [F2]: =COUNT(1/(A$2:A$34=D2)/FREQUENCY(B$2:B$34,B$2:B$34)) 
    Blessings!

  7. #7
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2505 and WPS V2024(12.1.0.18543)
    Posts
    4,113

    Re: Complex UNIQUE formula based on multiple criteria

    Cell F2 formula , Drag down

    Formula: copy to clipboard
    =SUMPRODUCT(($A$2:$A$34=$D2)*N(MATCH($B$2:$B$34,$B$2:$B$34,)=ROW($2:$34)-1))

  8. #8
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2505 and WPS V2024(12.1.0.18543)
    Posts
    4,113

    Re: Complex UNIQUE formula based on multiple criteria

    @Mike-Marks You're Welcome. Glad to help . Thank You for the feedback and 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. [SOLVED] formula to count unique values based on multiple criteria
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-27-2021, 09:19 PM
  2. Replies: 4
    Last Post: 04-04-2020, 05:36 AM
  3. Formula to count unique value in a sheet based on multiple criteria
    By dhasa in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-05-2018, 12:00 PM
  4. [SOLVED] Semi complex count formula based on multiple criteria
    By the machine in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-09-2018, 11:14 AM
  5. [SOLVED] Macro or Formula for Unique Value based on multiple criteria
    By Neilesh Kumar in forum Excel General
    Replies: 21
    Last Post: 05-08-2017, 01:48 PM
  6. [SOLVED] Challenging complex formula- unique count for multiple criteria on several levels
    By joannelittell in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-30-2013, 09:52 PM
  7. Formula to count Unique text based on multiple criteria
    By OAMPS in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-14-2012, 10:48 AM

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