+ Reply to Thread
Results 1 to 18 of 18

Profile and loss calculation?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Profile and loss calculation?

    hi exclers,
    how you I calculate a simple "profile and loss" base on the buy/sell order from a price array?
    any ideas or suggestions, see attached sheet... thx
    Attached Files Attached Files

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Profile and loss calculation?

    .
    Disregard
    Last edited by Logit; 09-11-2018 at 02:18 PM.

  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Profile and loss calculation?

    thx Logit , but its got to be a really solution (custom formula) to the attached sheet!

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,880

    Re: Profile and loss calculation?

    I can't find anything regarding "profile and loss" on the internet. Did you mean, as logit assumed, profit and loss? I am not in financials, but everything I encounter for calculating profit/loss is simply to add up "income" (whatever that means for your specific scenario) and add up "expenses" (again, whatever that means for your scenario), then take the difference of those two values. Your sample spreadsheet is fairly cryptic with only "buy" and "sell" indicators. How would you compute "income" from this data? How would you compute "expenses"?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    Judging from the formulas in column C I took a guess.
    Formula: copy to clipboard
    =SUMPRODUCT(--($B$1:$B$30="SELL"),$A$1:$A$30)-SUMPRODUCT(--($B$1:$B$30="BUY"),$A$1:$A$30)
    Dave

  6. #6
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Profile and loss calculation?

    does not see to work Flame....

    I need to calculate the profile/loss when it BUY (first BUY) and when it turns SELL, calculates the prices of BUY to SELL to get the profile or loss! etc...
    from the SELL signal the formula needs to look back down the array, at which was the BUY signal.

    keep in mind I need a very simple formula to active this as I will be using thousand of rows... keep try I got a hand full of stars ****** to give out here)

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    Try a helper column in D. In D1 and fill down
    Formula: copy to clipboard
    =(B1="SELL")*(B2="BUY")
    Then in C1 and filled down.
    Formula: copy to clipboard
    =IF(D1=1,A1-INDEX(A2:$A$30,MATCH("SELL",B2:$B$30,0)-1),"")
    Sum column C to get the total.

    You may have to re-format column C to the same as A.

    Does this do what you want?
    Last edited by FlameRetired; 09-11-2018 at 03:24 PM.

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,880

    Re: Profile and loss calculation?

    "does not see[m] to work" does not help us very much. Why doesn't it work? What do you want it to do differently? Can you provide any explanation of how you want to perform this calculation -- maybe even some worked examples in your spreadsheet? Flameretired's formula seems to assume that everything marked "sell" is income, and sums those values up (I would have used SUMIFS() rather than SUMPRODUCT(), but the idea is the same). He then assumes that everything marked "buy" is expense, and sums those values up. Profit/loss (still not sure what "profile" is or if it is different from profit) is then the difference between the two sums.

    If you are looking for a "moving" profit loss, it seems like it should be the same formula, but with a different mix of relative and absolute references. I can't make a recommendation, because it is not clear to me if this is the case, or exactly how you want to do this.

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    Me neither. These are all my best guesses.

  10. #10
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Profile and loss calculation?

    thx, FlameRetired
    but can't seem to get your formula to work?

    and yes MrShorty I looking for that "moving" profit loss... any ideas.
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,880

    Re: Profile and loss calculation?

    I don't yet understand exactly how you want to do this moving profit/loss, so I have no ideas. I still expect a difference of SUMIFS() or SUMPRODUCTS() like FlameRetired's first suggestion, but I don't understand how you intend to define the "window" for you moving profit/loss.

  12. #12
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    @ QuantEdge

    That's because the former column D is now column C. Try in D1 and filled down. It returns what you had in the former column C.
    Formula: copy to clipboard
    =IF(C1=1,A1-INDEX(A2:$A$30,MATCH("SELL",B2:$B$30,0)-1),"")
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Profile and loss calculation?

    thx FlameRetired,
    works really well and big thx...

  14. #14
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Profile and loss calculation?

    FlameRetired,
    PS is there any way to optimize (short/simpler etc) your formula, as so to make it run faster as I will be using it on a massive data set thousands of times?
    IF anyone can optimize I would be very grateful ** thx

  15. #15
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    Quote Originally Posted by QuantEdge View Post
    FlameRetired,
    PS is there any way to optimize (short/simpler etc) your formula, as so to make it run faster as I will be using it on a massive data set thousands of times?
    IF anyone can optimize I would be very grateful ** thx
    At the moment nothing comes to mind. I'll give it some thought though.

    RE: "massive data set thousands of times". Could you offer some hard numbers ... a range?

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    Good to hear, and you are welcome. Thank you for the feedback.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  17. #17
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    Will the data in column B always start with a "BUY"?

  18. #18
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,417

    Re: Profile and loss calculation?

    I have been playing with this and have a few ideas.

    shorter/faster/simpler comes down to "pick 2". I've focused on faster/simpler (uses 5 helper columns ... which are fast). I don't think I can do more than that with formula.

    Am awaiting replies to my last two posts 16/17.
    Last edited by FlameRetired; 09-12-2018 at 03:41 PM.

+ 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. Round robin win loss calculation
    By dwerbs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-12-2014, 11:40 PM
  3. [SOLVED] Profit / Loss calculation spreadsheet
    By cmb80 in forum Excel General
    Replies: 2
    Last Post: 09-26-2014, 04:35 AM
  4. [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
  5. [SOLVED] Last 10, 5 & 3 Win Loss calculation
    By dagindi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-11-2012, 04:50 PM
  6. Calculation of 'Stop Loss'; Buy/Sell price differences
    By babapusy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-23-2012, 03:10 AM
  7. Excel 2007 : Friction loss calculation help
    By trager551 in forum Excel General
    Replies: 2
    Last Post: 03-04-2010, 04:53 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