+ Reply to Thread
Results 1 to 5 of 5

Challenging Groupby-Like Formula

  1. #1
    Registered User
    Join Date
    06-16-2017
    Location
    Atlanta
    MS-Off Ver
    2013
    Posts
    21

    Challenging Groupby-Like Formula

    I am trying to come up with a way to have a running total of who owns what stock and how much they still own. Not sure if a groupby function would do the trick? Attached is a sample file. With more instructions. I appreciate the help.

    Alex
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Challenging Groupby-Like Formula

    Hi Alex,

    Create a new column called "Movement" with the formula
    =D2*IF(A2="Buy",1,IF(A2="Sell",-1,0))

    Autofill etc.
    This will create positive values for Buy and negative for Sell, 0 for undefined.

    Then create a pivot table (Insert > Pivot Table) and set the source to A1:F20 (including the new "Movement" column).

    Drag "Person" and "Stock" to Row Labels and then "Movement" to Values. It should default to "Sum of Movement".

    PT.PNG

  3. #3
    Registered User
    Join Date
    06-16-2017
    Location
    Atlanta
    MS-Off Ver
    2013
    Posts
    21

    Re: Challenging Groupby-Like Formula

    Beautiful. Thank You

  4. #4
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Challenging Groupby-Like Formula

    You're welcome

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Challenging Groupby-Like Formula

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

+ 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. groupby, count and sum
    By joe55555 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-01-2015, 07:10 PM
  2. GroupBy and distinct in excel
    By kumarsubram in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2011, 08:18 PM
  3. Excel 2007 : groupby and distinct
    By kumarsubram in forum Excel General
    Replies: 1
    Last Post: 06-07-2011, 05:23 PM
  4. Replies: 1
    Last Post: 04-12-2011, 07:00 PM
  5. Need Help with a challenging formula.
    By gamiensrule in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-16-2010, 10:05 PM
  6. [SOLVED] Challenging Formula
    By Gordon in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-23-2006, 04:30 PM
  7. Mimicking an GroupBy Clause in Excel
    By GreyPilgrim in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2006, 05:40 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