Closed Thread
Results 1 to 13 of 13

Help With FIFO U P/L & R P/L on Multiple Stocks

  1. #1
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    210

    Help With FIFO U P/L & R P/L on Multiple Stocks

    Hello Gents.,

    With all credits due to Excel Forum I managed to create a simple Stock Portfolio FIFO Template. It took me nearly a month of research to put something together but never got the FIFO P/L Calculations right. Until I read a post from Forum Expert kvsrinivasamurthy which I implemented it to my Sample.
    https://www.excelforum.com/excel-for...-of-stock.html

    I have entered simulated trades on Thinkorswimm platform to verify my results and they matched perfectly.

    Having said this, I have one small problems that I would like to resolve if possible.

    I am unable to input multiple Stock Symbols, I get bad results for obvious reasons. -See Table 1
    Currently I have to have Separate Table Per Symbol to get it right. -See Table 2 and 3

    It would be so much better if I could input all trades in one Table and get the right Results
    In Column P - Q - R. of Table 1.

    Column Y calculations are generated by the kvsrinivasamurthy's UDF Code.

    I have Highlighted in Table 1 the desired results that were copied from Table2 and Table 3.

    Hope it can be done, I personally have hit a wall.

    Thank you for your Help
    Cheers
    ONP
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    I am not clear about how the Highlighted cells values are arrived. with manual calculation explain how they are arrived.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    For column T in Table1 new UDF is used. Code is given below.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    210

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    hello KVS
    Thank you for your reply.

    I have attempted to explain the manual calculations as you requested. Its in the Sample, I hope the explanation makes sense, because often I even dont understand what I write.

    I have also inserted an array formulas in the blue highlighted cells in column P that will produce the requested results if copied down. That formula was written By Forum Guru Bo_Ry. I have no Idea how to read that formula, but it may help you understand the calculating methods he has aproached. Althou Bo_Ry formula works, it slows down my excel program drastically when calculating a large Data Base.

    The New improved Code you have provided Helps allot Thank you.

    Thank you for your time and Help
    Cheers
    ONP
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    210

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Hello KVS,
    Just wanted to let you and everyone know that I managed to solve the FIFO problem thanks to you.
    Every trade now calculates with FIFO method including the PL.
    Thank you Again for your Help

    I have attached a copy of the final FIFO working Portfolio Tracker.
    Hope many will benefit from this as I know many are looking for such.

    I will Mark this thread Solved
    Cheers
    ONP
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-19-2020
    Location
    Earth
    MS-Off Ver
    2000
    Posts
    2

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Very nice stuff. I was looking for something like that, but it would be great if works fine as well in these two situations.

    1) You start selling first and complete -close the trade- buying.

    AAPL SELL -100
    AAPL BUY +50
    AAPL BUY +50

    2) In some point, you are shorting, even started buying and you finally close the position, with a BUY.

    IBM BUY +100
    IBM SELL -75
    IBM SELL -50 (At this point, because you has sold everything you had, you are shorting, your net position is -25)
    IBM BUY +25


    Any idea for solve this issue these two scenarios commented before, mates?

    Thanks in advance!
    Last edited by Celsius765; 03-31-2021 at 02:23 AM.

  7. #7
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    210

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Hi Celsius, Got your message.
    Basically you want to log in short and long positions in the template.
    Give me a little time and ill see what i can do. Maybe someone else in the forum resolves the issue before me

    FYI the new template i have is a built up version of what was uploaded here. Its rather complex. It logs in Puts Calls Long and short positions. Of course all of the formulas ware the results of Excel Forum Help. I was tired of manually inputting data so now I just copy and paste the downloaded transactions from my brokers platform (TOS - from TD Ameritrade) and the template calculates everything i need. I have been working on it over 3 months and still making small improvements. Thus far all the excel calculations match the Brokers Platform to the penny.

    Cheers
    ONP

  8. #8
    Registered User
    Join Date
    09-19-2020
    Location
    Earth
    MS-Off Ver
    2000
    Posts
    2

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Quote Originally Posted by onp View Post
    Basically you want to log in short and long positions in the template. P
    Yes, you are right, onp.

    When you are margin trading, you can start selling -shares, cryptos or whatever- first or reached to certain point, being short but I see when the Cumulative Shares starts or reaches to the point that turns to negative, it doesn't work.

    Thanks for your fast answer and feedback, mate.

  9. #9
    Registered User
    Join Date
    04-08-2016
    Location
    india
    MS-Off Ver
    2007
    Posts
    1

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Hi ONP,

    Did you have any luck make thet sheet work for short positions?

    Regards
    Bhav

  10. #10
    Registered User
    Join Date
    10-05-2022
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    1

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Hi All. I just want to thank ONP for this sensational spreadsheet. It's exactly what I was looking for.
    Very much appreciated!!!
    Thank you for sharing if for free with the rest of the world.

  11. #11
    Registered User
    Join Date
    12-28-2022
    Location
    Cayman
    MS-Off Ver
    11
    Posts
    1

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Hello - what is the FIFO code formula in column P?

  12. #12
    Registered User
    Join Date
    04-22-2023
    Location
    India
    MS-Off Ver
    2021
    Posts
    4

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    Superb worksheet. very helpful. Is it possible to bring the holding period of each shares in the excel

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,991

    Re: Help With FIFO U P/L & R P/L on Multiple Stocks

    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 #4 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
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need fifo qty and value in fifo qty and value column
    By makhdoomliaqat in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-28-2021, 07:16 AM
  2. CAGR Formula for multiple stocks
    By eugchen in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-28-2020, 03:24 PM
  3. Posting Maltiple Payments to Multiple Invoices – FIFO Method
    By amardas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2013, 12:40 AM
  4. Code to evaluate FIFO for multiple items and dates.
    By BillRush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2011, 11:09 PM
  5. How to retrieve data for multiple stocks?
    By MarginofBuffett in forum Excel General
    Replies: 1
    Last Post: 10-22-2011, 07:44 PM
  6. FIFO valuation Calculation for Stocks
    By CJD in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-24-2009, 02:07 AM
  7. [SOLVED] Stocks
    By cheryl church in forum Excel General
    Replies: 1
    Last Post: 08-11-2006, 01:20 AM

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