+ Reply to Thread
Results 1 to 13 of 13

Profit & Loss FIFO Stock Trading

  1. #1
    Registered User
    Join Date
    11-17-2016
    Location
    Omaha NE USA
    MS-Off Ver
    Mac Office 2016
    Posts
    2

    Profit & Loss FIFO Stock Trading

    I am trying to figure out how to set up a spreadsheet that can match stock trades using FIFO when there are sells of partial lots and multiple securities listed on the spreadsheet. I do not want a running total for each symbol. I am looking to determine profit and loss per lot sold, so there will be partial lots being sold and added to all day long. By the end of the year, there could be 50 thousand trades on the spreadsheet with some sold the same day and others added and sold months later in various lots. Any help would be greatly appreciated.

    I have posted to 2 other boards and received no reply form either:
    http://www.ozgrid.com/forum/showthread.php?t=201836
    http://www.mrexcel.com/forum/excel-q...sing-fifo.html
    Attached Files Attached Files
    Last edited by kramer100; 11-19-2016 at 01:57 PM. Reason: Spreadsheet Addition

  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,875

    Re: Profit & Loss FIFO Stock Trading

    Welcome to the forum!

    Unfortunately our post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    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
    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,875

    Re: Profit & Loss FIFO Stock Trading

    Thank you for adding links to your other posts.

  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,875

    Re: Profit & Loss FIFO Stock Trading

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Profit & Loss FIFO Stock Trading

    I think it's a messy problem -- not hard, messy.

    Here's a FIFO accounting for a single item (maybe gasoline):

    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    2
    Sales
    3
    Date
    1-Jan
    7-Jan
    16-Jan
    26-Jan
    2-Feb
    7-Feb
    11-Feb
    20-Feb
    5
    Sell
    3,912
    3,424
    7,032
    17,128
    10,483
    9,180
    284
    4,062
    6
    Purchases
    Avg Cost
    $ 2.840
    $ 2.840
    $ 2.661
    $ 2.603
    $ 2.918
    $ 2.773
    $ 2.760
    $ 2.661
    7
    Date
    Unit Cost
    Qty
    DoNotUse
    8
    1-Jan
    $ 2.84
    8,900
    3,912
    3,424
    1,564
    0
    0
    0
    0
    0
    9
    10-Jan
    $ 2.61
    7,700
    0
    0
    5,468
    2,232
    0
    0
    0
    0
    10
    13-Jan
    $ 2.36
    8,800
    0
    0
    0
    8,800
    0
    0
    0
    0
    11
    20-Jan
    $ 2.95
    8,200
    0
    0
    0
    6,096
    2,104
    0
    0
    0
    12
    27-Jan
    $ 2.91
    9,200
    0
    0
    0
    0
    8,379
    821
    0
    0
    13
    6-Feb
    $ 2.76
    8,700
    0
    0
    0
    0
    0
    8,359
    284
    57
    14
    12-Feb
    $ 2.66
    9,300
    0
    0
    0
    0
    0
    0
    0
    4,005


    The body of the table shows the amounts of each purchase lot used to make a given sale.

    You have lots of different items. The same approach could be used, at the expense of some additional complexity in the formulas. But you'd run out of columns with the number of transactions you're talking about.

    A VBA solution would be doable in the format you have, but you'd lose the auditability that the format above has.
    Last edited by shg; 11-19-2016 at 02:05 PM.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Profit & Loss FIFO Stock Trading

    There are surely stock-trading programs that do this ...

  7. #7
    Registered User
    Join Date
    11-17-2016
    Location
    Omaha NE USA
    MS-Off Ver
    Mac Office 2016
    Posts
    2

    Re: Profit & Loss FIFO Stock Trading

    Thought I would follow up. I think I have a solution. Not the format I wanted but workable. If anyone has an idea on how to combine Buy & Sell columns into a single using the negative sign to denote selling that would be great.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-21-2013
    Location
    miami
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Profit & Loss FIFO Stock Trading

    Can any one help with figuring out why i can not start with a negative position on Kramer's Excel sheet.

  9. #9
    Registered User
    Join Date
    12-24-2017
    Location
    Houston
    MS-Off Ver
    2017
    Posts
    1

    Re: Profit & Loss FIFO Stock Trading

    @kramer100, thank you so much for sharing your excel sheet! I have been trying to solve this FIFO trading issue in google sheets for the past couple of days and realized it's quite complicated. Your spreadsheet has really helped significantly! Could you please explain what the following columns mean? MATCH (both columns) and BAL. STOCK. I'm also having a bit of trouble deciphering column J (Differential Cost). Can you explain that formula and the column's purpose as well?

    Thank you again so much!

  10. #10
    Registered User
    Join Date
    10-06-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Profit & Loss FIFO Stock Trading

    Thank you So much. Good Work.

  11. #11
    Registered User
    Join Date
    11-13-2019
    Location
    Istanbul, Turkey
    MS-Off Ver
    Office 2016
    Posts
    3

    Re: Profit & Loss FIFO Stock Trading

    Quote Originally Posted by kramer100 View Post
    Thought I would follow up. I think I have a solution. Not the format I wanted but workable. If anyone has an idea on how to combine Buy & Sell columns into a single using the negative sign to denote selling that would be great.
    I know I am late by three years but I could not figure out how to modify it for calculating P/L for buy rows, not sell rows. I would like to see how much P/L generated for each individual acquisition.

  12. #12
    Registered User
    Join Date
    12-21-2023
    Location
    Germany
    MS-Off Ver
    365
    Posts
    1

    Re: Profit & Loss FIFO Stock Trading

    Has anyone an idea how this can be adapted to also cover short selling? I.e. starting the position by selling stocks and closing the position by buying stocks.

  13. #13
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Profit & Loss FIFO Stock Trading

    Quote Originally Posted by zooeysalinger View Post
    I know I am late by three years
    Quote Originally Posted by joehier View Post
    Has anyone an idea how this can be adapted
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Help with win loss and tie column & adding profit based on win or loss.
    By schroeder641 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2016, 03:41 PM
  2. FIFO for stock trading
    By TK2013 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-11-2016, 05:00 AM
  3. [SOLVED] Trading Spreadsheet - Random win/loss outcome against established Win/Loss %
    By cruze2005 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-18-2014, 05:08 AM
  4. FIFO Stock Profit
    By dandan9999 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-11-2013, 02:43 PM
  5. 1. consecutive days of profit and of losses 2. biggest profit loss since date
    By xbohemianx in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-14-2013, 12:57 PM
  6. Inventory stock / PROFIT using FIFO
    By pdo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-09-2012, 02:46 PM
  7. [SOLVED] Stop Loss Formulas for Stock Trading
    By zmr325 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-28-2005, 03:25 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