+ Reply to Thread
Results 1 to 6 of 6

Time weighted number of shares

  1. #1
    Registered User
    Join Date
    03-03-2019
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    17

    Time weighted number of shares

    Hello all,

    I want to calculate what is the time weighted number of shares I held throughout the month. If you are unfamiliar with the concept, I have made an example in the attached sheet. General idea is, say as of end of last month I held 100 shares. Middle of this month I bought 100 more shares. While as of end of this month I would be holding 200 shares, in reality the time weighted average amount of shares I held were closer to 150.

    The problem is I'm having trouble getting that result through one formula. Perhaps you guys can help in that regard. (the "x"s need to be the output location)
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,085

    Re: Time weighted number of shares

    you used an average over the month to calculate the average

    so assuming this is OK for your need

    AVERAGEIFS() - if you have the correct version of excel
    Otherwise as you have 2016 in your profile

    SUMIFS()/COUNTIFS()
    should work OK in 2007 + versions, i think

    see attached

    Not sure why you are showing the average in Jan date , when the month data is Feb, BUT we can adjust once i understand that
    Attached Files Attached Files
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    03-03-2019
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    17

    Re: Time weighted number of shares

    Ahhhh my bad, it is supposed to be for Feb not Jan my mistake. That aside, I think I might've not explained the sheet very well.

    Columns B and C are just supposed to show the running balance of the share holdings. At the beginning, I had 0 shares, there is a transaction on 13/2/2020 where I get 100 shares, and then 23/2/2020 I get another 100 shares, etc.

    However in reality having a running balance shown might not a preferable method for me because I might be doing this for 20+ different people who all have their own unique transactions.

    So lets just focus on this case where we have a) the list of transactions (aka buy/sell of shares) and b) the date at which I want to see the average weighted shares number at.

    I understand the task is a bit demanding, mostly just hoping to see if there is a formula that can keep a updated running balance within its formula, sort of like a dynamic array

  4. #4
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Time weighted number of shares

    @kohno71.... In general, a weighted average is calculated by SUM(d[i]*w[i], i=1,...,n) / SUM(w[i], i=1,...,n), where d[i] and w[i] are the data and corresponding weighting factor.

    Your attachment presents the data in several forms. It is not clear to me what form we should use for a solution.

    Suppose the data is in the following form. See the "Summary" table.

    Then the monthly and total weighted averages can be calculated as follows. See the "Weighted Average" table.

    Note that the total average is not a simple average of the monthly averages (C29).

    Instead, it is a weighted average, either of the monthly averages (C27) or the entire summary data (C28).

    (Sorry about the presentation. I am working-around limitations or defects in this forum.)

    Please Login or Register  to view this content.
    A B C D E
    1 Transactions
    2 Date Shares
    3 2/13/2020 100
    4 2/23/2020 100
    5 3/12/2020 20
    6 4/4/2020 300
    7 5/6/2020 -40
    8
    9 Summary
    10 Shares #Days
    11 2/1/2020 2/12/2020 0 12
    12 2/13/2020 2/22/2020 100 10
    13 2/23/2020 2/29/2020 200 7
    14 3/1/2020 3/11/2020 200 11
    15 3/12/2020 3/31/2020 220 20
    16 4/1/2020 4/3/2020 220 3
    17 4/4/2020 4/30/2020 520 27
    18 5/1/2020 5/5/2020 520 5
    19 5/6/2020 5/31/2020 480 26
    20
    21 Weighted Average
    22 Shares #Days
    23 Feb'20 82.7586 29
    24 Mar'20 212.9032 31
    25 Apr'20 490.0000 30
    26 May'20 486.4516 31
    27 TOTAL 320.4959 121 correct
    28 320.4959 correct
    29 318.0284 wrong!
    Attached Files Attached Files
    Last edited by joeu2004; 02-19-2021 at 07:02 PM.

  5. #5
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Time weighted number of shares

    Quote Originally Posted by kohno71 View Post
    So lets just focus on this case where we have a) the list of transactions (aka buy/sell of shares) and b) the date at which I want to see the average weighted shares number at.
    Quote Originally Posted by joeu2004 View Post
    Your attachment presents the data in several forms. It is not clear to me what form we should use for a solution.
    Oh, I overlooked that comment in your second posting.

    But still, #b is unclear. In particular, ``the date at which I want to see the average weighted shares`` measured from when?

    Assuming that you want monthly weighted averages, I think the tables that I presented previously are close to the way that you should design the data in order to make it easy(er) to calculate the weighted averages.
    Last edited by joeu2004; 02-19-2021 at 08:29 PM.

  6. #6
    Registered User
    Join Date
    03-03-2019
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    17

    Re: Time weighted number of shares

    Yes, your assumption of using monthly weighted averages is correct. Apologies for not making that part clear.

    I hadn't thought of sumproducts, its actually an excellent idea. The formula seems a lot less volatile as well. Many thanks for your help!

+ 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] Weighted Average of Sequential Time Based Data Series Using Start/End Time Input
    By marcoyul in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-16-2017, 12:10 PM
  2. Time weighted return - really need help :(
    By domgilberto in forum Excel General
    Replies: 1
    Last Post: 02-05-2015, 03:25 PM
  3. Time-Weighted Average
    By andyXL in forum Excel General
    Replies: 1
    Last Post: 09-04-2013, 07:54 AM
  4. Weighted Average of Time
    By ExcelAteMyHomework in forum Excel General
    Replies: 5
    Last Post: 02-11-2011, 08:41 PM
  5. [SOLVED] Time weighted investment returns
    By TWIRR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2006, 07:40 PM
  6. Replies: 1
    Last Post: 05-17-2006, 11:55 PM
  7. [SOLVED] Time Weighted Return Function
    By Greg in forum Excel General
    Replies: 2
    Last Post: 03-09-2006, 01:25 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