+ Reply to Thread
Results 1 to 8 of 8

Succeeded in counting distinct values, but can’t get them to display across row

Hybrid View

  1. #1
    Registered User
    Join Date
    12-28-2020
    Location
    Kampala, Uganda
    MS-Off Ver
    Office 365
    Posts
    4

    Succeeded in counting distinct values, but can’t get them to display across row

    My source spreadsheet has information on 46 projects across a few hundred rows. I am coding a “quick view” sheet that will summarize key information from each project in one row each - so 46 total rows.

    I have easily created the quick view sheet to return only 1 instance of each uniquely named project, to add funding amounts to show the total funding for each, and to return the number of contractors who received funding for each project. It has columns A (helper column to find distinct project names), B(project title, correctly shows each of 46 only once), C(total funding, corrected added for each project title), ... , G (# of different contractors who received funding for that project), and then I want columns H-R to be the list of contractors (11 is the maximum).

    So, in G2 I have “=IFERROR(ROWS(UNIQUE(FILTER(‘Project tracker’!$G$2:$G$1001, ‘Project tracker’!$C$2:$C$1001=$B2, “”))),0).

    That returns the correct value for how many distinct contractors (listed in Project Tracker sheet in column G) for each project (listed in Funds Tracker sheet in column C). Column B on my ‘Quick View’ sheet has each project named only once (so 46 columns).

    If I do in row H =IFERROR(UNIQUE(FILTER(‘Project tracker’!$G$2:$G$1001, ‘Project tracker’!$C$2:$C$1001=$B2,””))),0) it correctly lists all of the contractors only once each. BUT the 0365 dynamic array function spills the results down the column and I get a !SPILL error as the rows below are not blank.

    So I tried in row H =IFERROR(UNIQUE(INDEX(‘Project tracker’!$G$2:$G$1001,SMALL(IF($B2=‘Project tracker’!$C$2:$C$1001,ROW(‘Project tracker’!$C$2:$C$1001)-ROW(‘Project tracker’!$C$2)+1),1)),0),””)).

    I copy and paste from H2 to R2, changing the last 1 to 2, 3, 4, etc to give the 2nd distinct value, 3rd distinct value, etc. The formula almost works, but is giving duplicate values. (For a project that has 6 rows in my source sheet with 3 contractors receiving funds, for example, instead of getting output of H2-J2 as Alliant. CPHL. RHSP as I want, I will get H2-J2 as Alliant CPHL Alliant, and taking it out further will show full list as Alliant CPHL Alliant RHSP Alliant CPHL RHSP etc...).

    Can someone help me figure out how to either get the dynamic array to spill across a row instead of down a column, or to fix the other formula so that it finds only the first of each distinct contractor and no duplicates? MUCH APPRECIATED.
    Last edited by AliGW; 12-28-2020 at 11:55 AM. Reason: Please do NOT post edit your posts in this way - it makes the entire thread nonsensical!

  2. #2
    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. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,465

    Re: Succeeded in counting distinct values, but can’t get them to display across row

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    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.

  3. #3
    Registered User
    Join Date
    12-28-2020
    Location
    Kampala, Uganda
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Succeeded in counting distinct values, but can’t get them to display across row

    Oh my. Makes sense, let me try to re-create a sample.
    Thanks.

  4. #4
    Registered User
    Join Date
    12-28-2020
    Location
    Kampala, Uganda
    MS-Off Ver
    Office 365
    Posts
    4

    Succeeded in counting distinct values, but can’t get them to display (sample attached)

    Ok, here's trying to attach sample worksheet.
    On the "quick view" page, I am trying to get the columns labeled "mechanisms" to display all of the contractors that are correctly counted in column D, but to show up only once each. Right now, the formula is returning duplicates. So column D correctly tells me how many different contractors received funding, and in the following columns I want to see who all of those contractors are (but shown only once each).
    TIA!
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,745

    Re: Succeeded in counting distinct values, but can’t get them to display across row

    Maybe
    =TRANSPOSE(UNIQUE(FILTER('Project tracker'!$G$2:$G$1001, 'Project tracker'!$C$2:$C$1001=$B2,"")))

  6. #6
    Registered User
    Join Date
    12-28-2020
    Location
    Kampala, Uganda
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Succeeded in counting distinct values, but can’t get them to display across row

    Oh my gosh, that totally worked. I tried transpose, but obviously screwed up the way I wrote it somehow (and am obviously very new to O365 and these dynamic arrays!).
    THANK YOU

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,745

    Re: Succeeded in counting distinct values, but can’t get them to display across row

    You're welcome & thanks for the feedback.

  8. #8
    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. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,465

    Re: Succeeded in counting distinct values, but can’t get them to display across row

    Do NOT post edit your posts - it makes a complete nonsense of the thread. I have reinstated your first post and correctly marked the thread as solved for you.

+ 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. Counting distinct values across columns
    By winkywright in forum Excel General
    Replies: 5
    Last Post: 12-09-2020, 09:35 AM
  2. counting distinct values within different sub-ranges
    By LeeroyReidy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-06-2020, 12:04 PM
  3. Display distinct values and their counts
    By elzool in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-29-2019, 03:06 PM
  4. [SOLVED] Counting distinct values in relation to text values in a separate coulumn
    By Streatty in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-06-2019, 11:04 AM
  5. Counting distinct values in Excel
    By ca16 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-26-2016, 12:42 PM
  6. [SOLVED] Counting distinct values with blank cells produces #DIV/0!
    By antexity in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-14-2015, 09:00 AM
  7. Counting Distinct Values
    By giantwolf in forum Excel General
    Replies: 4
    Last Post: 12-29-2005, 11:03 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