Vlookup with multiple values and a limiter
Results 1 to 2 of 2

Thread: Vlookup with multiple values and a limiter
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2019
    Posts
    43
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Vlookup with multiple values and a limiter

    Hi guys,

    I am trying to use a vlookup up to calculate whether a capital gain or loss has been made or lost when selling shares. A major problem I have is; if shares are purchased in two separate lots and at different prices, when I sell a portion of the shares I need to calculate the capital gain or loss on all the first lot of shares, if I sell more shares than I bought in the first lot then I need to move onto the second lot I bough. Then when I sell the rest of the shares at a later date I need to take off from the amount of shares I have left after selling the first lot.

    For example, in the table below, 100 units of ANZ were purchased on 20/5/2016 and a further 60 units of ANZ were purchased on 7/7/2016.
    140 units of ANZ were then sold on the 5/8/2016 so the capital gain is worked out by Total return-Total Cost=Capital Gain. However, the Total Cost in this case is 100 units at $10 + 40 units at $2 =$1,080. Therefore, the Capital Gain in this case is $1,680-$1,080=$600. When the further 20 ANZ shares are sold the cost will be the remaining amount of shares (40*$2).

    BBOZ sale is similar to ANZ. However, the first sale cost comes from the first purchase and the cost of the second sale of BBOZ comes from 10 units in the first buy then the remaining from the second lot.

    Keep in mind that another partial lot of shares could be sold but in this example this doesn't occur.

    If you need further explanation please let me know.

    Thanks for your help!

    Company Date Units Purchased Purchase Price Total Cost Units Sold Unit price Total Return Capital Gain
    ANZ 20/5/2016 100 10 1,000
    BBOZ 25/5/2016 90 9 810
    BBOZ 3/6/2016 80 8 640
    BBUS 5/6/2016 70 7 490
    ANZ 7/7/2016 60 2 120
    BBOZ 1/8/2016 80 11 880 160
    ANZ 5/8/2016 140 12 1,680 600
    ANZ 10/8/2016 20 13 260 220
    BBOZ 15/8/2016 90 5 450 -280

  2. #2
    New Member
    Join Date
    May 2019
    Posts
    43
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Vlookup with multiple values and a limiter

    The formula is to go in column I to be clear.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •