+ Reply to Thread
Results 1 to 11 of 11

do a weighted average of a outcome multiple deals multiple periods

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    31

    Question do a weighted average of a outcome multiple deals multiple periods

    Dear Sir/Madam,
    I have a data set which contains information between buyers and sellers for a certain period of time. I have multiple buyers, multiple sellers and multiple times. For each buyer, there are situations where the given buyer has more than one deals with the same seller at a given time.

    I need to generate a weighted average of the price for a given pair of trading relationship at a given moment of time (e.g year). The weight I am using is the amount of trade for each deal between the same pair at a given moment of time divided the total amount of all deals for the pair at the same moment of time.

    for example, buyer A and seller B have 3 deals in day one. The first deal is 20 apples and the price is 1 dollar each apple. the second deal is 30 apples and the price is 1.1 dollar each apple and the third deal is 25 apples and the price is 0.9 each apple. I am intended to calculate the weighted average price of apple for A and B in day one as follows: (20/(20+30+25))*1+(30/(20+30+25))*1.1+(25/(20+30+25))*0.9


    I understand I can use excel comment such as sumif/sumifs together with others to achieve what I want. But my case in question is more complicated since I have quite large number of buyers, quite large number of sellers, quite large number of times and high proportion of deals between the same pair for a given moment of time.

    I hope to get your help by using VBA.

    I enclose a hypothetical example of my data set here.

    Thank you for your help and I hope to hear from you soon.

    Tianshu
    Attached Files Attached Files
    Last edited by tianshu; 03-18-2018 at 04:16 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: do a weighted average of a outcome multiple deals multiple periods

    You will need to provide some expected results as well as sample source data.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-01-2012
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: do a weighted average of a outcome multiple deals multiple periods

    Dear AliGW,

    I just edited my question by presenting a example in the main text. Could please have a look to see whether the question is more clear now?

    Thanks
    Tianshu

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: do a weighted average of a outcome multiple deals multiple periods

    No, sorry - please add some expected results to the attached workbook. Thanks.

  5. #5
    Registered User
    Join Date
    10-01-2012
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: do a weighted average of a outcome multiple deals multiple periods

    Dear AliGW,

    I have edited the excel which contains the hypothetical example by adding the expected result.

    Please have a look again. Hope now it is informative.

    Thanks again,

    Tianshu

  6. #6
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: do a weighted average of a outcome multiple deals multiple periods

    If you provide File with 2 sheets

    1 sheet how data with orginal data looks and
    1 sheet how you want the result looks

    then we can do the necessary

    Kind regards
    Leo

  7. #7
    Registered User
    Join Date
    10-01-2012
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: do a weighted average of a outcome multiple deals multiple periods

    Dear Leo and other friends in the forum,

    I further adjusted my data in the spreadsheet. Now the first worksheet contains the raw data and the second one contains the manipulation steps and the expected results I hope to get after the manipulation.

    Thanks in advance.

    Tianshu
    Last edited by tianshu; 03-18-2018 at 04:31 AM.

  8. #8
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: do a weighted average of a outcome multiple deals multiple periods

    Please Login or Register  to view this content.
    Kind regards
    Leo
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-01-2012
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: do a weighted average of a outcome multiple deals multiple periods

    Dear Leo,

    thanks for the reply. I am sorry for taking time to response since I was travelling.

    I see the first number in the trade pair column is the order of the trade rather than the time when the trade takes place. I am wondering whether and how I can change it into the time (for example in my hypothetical case, I only have two times, 1 and 2. I am hoping the result still shows the time as either separate column or first letter of the trade pair. This information is needed for further data manipulation).

    thanks.

    Tianshu

  10. #10
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: do a weighted average of a outcome multiple deals multiple periods

    Please Login or Register  to view this content.
    Kind regards
    Leo
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-01-2012
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: do a weighted average of a outcome multiple deals multiple periods

    Hi, Leo,

    Thank you very much for your help.

    Tianshu

+ 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. Replies: 0
    Last Post: 02-15-2018, 03:04 AM
  2. [SOLVED] Weighted average with multiple text exclusions
    By Toyo613 in forum Excel General
    Replies: 4
    Last Post: 11-21-2017, 01:44 PM
  3. Weighted Average multiple criteria
    By Framboosje in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-18-2017, 10:19 AM
  4. Replies: 11
    Last Post: 08-10-2017, 02:41 AM
  5. Weighted Average for multiple sheets
    By walkingcow in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-12-2016, 01:34 PM
  6. [SOLVED] Weighted Average multiple condition
    By tabkaz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-28-2014, 07:42 AM
  7. Weighted Average with multiple variables
    By bigtoad in forum Excel General
    Replies: 4
    Last Post: 02-27-2011, 04:07 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