+ Reply to Thread
Results 1 to 3 of 3

Show unique string from one column only if related unique sum from another column is > 0

  1. #1
    Registered User
    Join Date
    04-25-2024
    Location
    New Hampshire, USA
    MS-Off Ver
    Version 16.84 for Mac
    Posts
    1

    Show unique string from one column only if related unique sum from another column is > 0

    Hey guys, I've been stumped trying to figure this out for the past day. I am making a stock portfolio tracker. I am currently using the UNIQUE function to pull all the stocks inputted from a column on one sheet labeled "Transactions" and display them in a column on another sheet labeled "Dashboard."

    The formula I'm using, =UNIQUE(Transactions[Stock Name]), works. However, I need to take this a step further and make it so it only displays the unique stock name only if the sum of shares that correspond to it are greater than 0. The formula I've tried for this that does NOT work is, =UNIQUE(Transactions[Stock Name],SUMIFS(Transactions[Stock Name],Transactions[Stock Name],Transactions[Shares])), but it does not give an error message either. It shows the first stock name but then does not display the rest regardless of the amount of shares bought.

    Here's an example of what partially worked:
    What Works.png

    This is what I've tried that seems like it's doing something...
    What I've tried.png

    Here's an example screenshot of where it's pulling the data from:
    TransactionsSheet.png

  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. 2509 (Windows 11 Home 24H2 64-bit)
    Posts
    92,809

    Re: Show unique string from one column only if related unique sum from another column is >

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is your forum profile showing the Excel PRODUCT that you need this to work for?

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The three most recent Excel products are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Volunteer organiser & photographer with the Sutton Hoo Ship's Company: https://saxonship.org/
    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
    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. 2509 (Windows 11 Home 24H2 64-bit)
    Posts
    92,809

    Re: Show unique string from one column only if related unique sum from another column is >

    You are not understanding the second parameter of the unique function.

    Try this:

    =LET(u,UNIQUE(A1:A11),FILTER(u,SUMIF(A1:A11,u,B1:B11)>0))

    or this:

    =LET(u,UNIQUE(A1:A11),s,SUMIF(A1:A11,u,B1:B11),FILTER(HSTACK(u,s),s<>0))

    where column A contains the stock names and column B the transactions.

    You will need to adapt this to your own workbook. If it doesn't work, then attach a sample book.

    If you want to return the amounts and not the stock names, then
    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)

Similar Threads

  1. [SOLVED] Extract unique items from column and store some related data
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-05-2018, 08:15 AM
  2. Replies: 2
    Last Post: 11-11-2015, 10:25 AM
  3. Replies: 0
    Last Post: 11-10-2015, 05:59 PM
  4. [SOLVED] Count the number of Unique Items in a Column for each Unique Item in another Column
    By HangMan in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-27-2015, 01:18 PM
  5. Need to show the Unique Value and related Count Based on Other Column
    By Kandavalli.Kiran in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2015, 05:23 AM
  6. [SOLVED] Count unique occurences in one column with unique occurances in another column
    By 21stCenturyLessons in forum Excel General
    Replies: 5
    Last Post: 07-12-2014, 08:44 AM
  7. Replies: 3
    Last Post: 08-29-2010, 03:31 PM

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